diff --git a/packages/block-library/src/site-logo/edit.js b/packages/block-library/src/site-logo/edit.js index 9bd1d5eba276eb..6e7dcf41671c98 100644 --- a/packages/block-library/src/site-logo/edit.js +++ b/packages/block-library/src/site-logo/edit.js @@ -233,7 +233,7 @@ export default function LogoEdit( { const [ logoUrl, setLogoUrl ] = useState(); const [ error, setError ] = useState(); const ref = useRef(); - const { mediaItemData, sitelogo, url } = useSelect( ( select ) => { + const { mediaItemData, siteLogo, url } = useSelect( ( select ) => { const siteSettings = select( coreStore ).getEditedEntityRecord( 'root', 'site' @@ -241,14 +241,14 @@ export default function LogoEdit( { const mediaItem = select( coreStore ).getEntityRecord( 'root', 'media', - siteSettings.sitelogo + siteSettings.site_logo ); return { mediaItemData: mediaItem && { url: mediaItem.source_url, alt: mediaItem.alt_text, }, - sitelogo: siteSettings.sitelogo, + siteLogo: siteSettings.site_logo, url: siteSettings.url, }; }, [] ); @@ -256,7 +256,7 @@ export default function LogoEdit( { const { editEntityRecord } = useDispatch( coreStore ); const setLogo = ( newValue ) => editEntityRecord( 'root', 'site', undefined, { - sitelogo: newValue, + site_logo: newValue, } ); let alt = null; @@ -274,13 +274,13 @@ export default function LogoEdit( { if ( ! media.id && media.url ) { // This is a temporary blob image - setLogo( '' ); - setError(); + setLogo( undefined ); + setError( null ); setLogoUrl( media.url ); return; } - setLogo( media.id.toString() ); + setLogo( media.id ); }; const onUploadError = ( message ) => { @@ -301,7 +301,7 @@ export default function LogoEdit( { const label = __( 'Site Logo' ); let logoImage; - if ( sitelogo === undefined ) { + if ( siteLogo === undefined ) { logoImage = ; } diff --git a/packages/block-library/src/site-logo/index.php b/packages/block-library/src/site-logo/index.php index f14feb0cb07a8f..db2d85d11de943 100644 --- a/packages/block-library/src/site-logo/index.php +++ b/packages/block-library/src/site-logo/index.php @@ -66,8 +66,8 @@ function register_block_core_site_logo() { * @return string The site logo if set. */ function override_custom_logo_theme_mod( $custom_logo ) { - $sitelogo = get_option( 'sitelogo' ); - return false === $sitelogo ? $custom_logo : $sitelogo; + $site_logo = get_option( 'site_logo' ); + return false === $site_logo ? $custom_logo : $site_logo; } /** @@ -81,9 +81,9 @@ function sync_site_logo_to_theme_mod( $custom_logo ) { // Delete the option when the custom logo does not exist or was removed. // This step ensures the option stays in sync. if ( empty( $custom_logo ) ) { - delete_option( 'sitelogo' ); + delete_option( 'site_logo' ); } else { - update_option( 'sitelogo', $custom_logo ); + update_option( 'site_logo', $custom_logo ); } return $custom_logo; } @@ -94,12 +94,12 @@ function sync_site_logo_to_theme_mod( $custom_logo ) { function register_block_core_site_logo_setting() { register_setting( 'general', - 'sitelogo', + 'site_logo', array( 'show_in_rest' => array( - 'name' => 'sitelogo', + 'name' => 'site_logo', ), - 'type' => 'string', + 'type' => 'integer', 'description' => __( 'Site logo.' ), ) ); diff --git a/packages/editor/src/components/entities-saved-states/index.js b/packages/editor/src/components/entities-saved-states/index.js index 32dc24a6c6e08f..af233aec56f264 100644 --- a/packages/editor/src/components/entities-saved-states/index.js +++ b/packages/editor/src/components/entities-saved-states/index.js @@ -22,7 +22,7 @@ import EntityTypeList from './entity-type-list'; const TRANSLATED_SITE_PROTPERTIES = { title: __( 'Title' ), description: __( 'Tagline' ), - sitelogo: __( 'Logo' ), + site_logo: __( 'Logo' ), show_on_front: __( 'Show on front' ), page_on_front: __( 'Page on front' ), };