diff --git a/includes/WP_Admin.php b/includes/WP_Admin.php index 16e2b5fdb..a83379e51 100644 --- a/includes/WP_Admin.php +++ b/includes/WP_Admin.php @@ -34,6 +34,7 @@ public function __construct() { if ( 'sitegen' === Data::current_flow() ) { \add_action( 'load-themes.php', array( __CLASS__, 'mark_sitegen_generated_themes' ) ); SiteGenService::pre_set_filter_wonder_blocks_transients(); + SiteGenService::instantiate_sitegen_hooks(); } } diff --git a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js index 69a4cba8a..d7c2917c5 100644 --- a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js +++ b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js @@ -1,4 +1,5 @@ import { useEffect, useRef } from '@wordpress/element'; +import { store as coreStore } from '@wordpress/core-data'; import { useLocation } from 'react-router-dom'; import { useSelect, useDispatch } from '@wordpress/data'; @@ -40,6 +41,12 @@ const SiteGen = () => { }; }, [] ); + // Update Title and Tagline on the site. + const { editEntityRecord } = useDispatch( coreStore ); + const { getEditedEntityRecord } = useSelect( ( select ) => { + return select( coreStore ); + }, [] ); + useEffect( () => { document.body.classList.add( `nfd-brand-${ newfoldBrand }` ); }, [ newfoldBrand ] ); @@ -100,8 +107,7 @@ const SiteGen = () => { identifier, skipCache ); - - if ( data.body !== null ) { + if ( data !== null ) { currentData.sitegen.siteGenMetaStatus.currentStatus += 1; if ( currentData.sitegen.siteGenMetaStatus.currentStatus === @@ -110,6 +116,13 @@ const SiteGen = () => { currentData.sitegen.skipCache = false; } setCurrentOnboardingData( currentData ); + + if ( identifier === 'site_config' ) { + editEntityRecord( 'root', 'site', undefined, { + title: data.site_title, + description: data.tagline, + } ); + } } } catch ( err ) { if ( retryCount < MAX_RETRIES_SITE_GEN ) { @@ -201,6 +214,7 @@ const SiteGen = () => { useEffect( () => { initializeThemes(); initializeSettings(); + getEditedEntityRecord( 'root', 'site' ); }, [] ); return (