Fix `store-title` endpoint - Pass default value to `get_option` (#50673)

* Pass default value to get_option

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Alba Rincón 2024-08-14 14:37:30 +02:00 committed by GitHub
parent 88e4a6f0e9
commit 3491c6b7dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
Fix `store-title` endpoint - Pass default value to `get_option`.

View File

@ -86,8 +86,8 @@ class StoreTitle extends AIEndpoint {
);
}
$store_title = html_entity_decode( get_option( self::STORE_TITLE_OPTION_NAME ) );
$previous_ai_generated_title = html_entity_decode( get_option( self::AI_STORE_TITLE_OPTION_NAME ) );
$store_title = html_entity_decode( get_option( self::STORE_TITLE_OPTION_NAME, '' ) );
$previous_ai_generated_title = html_entity_decode( get_option( self::AI_STORE_TITLE_OPTION_NAME, '' ) );
if ( strtolower( trim( self::DEFAULT_TITLE ) ) === strtolower( trim( $store_title ) ) || ( ! empty( $store_title ) && $previous_ai_generated_title !== $store_title ) ) {
return rest_ensure_response( array( 'ai_content_generated' => false ) );