diff --git a/plugins/woocommerce-admin/client/header/index.js b/plugins/woocommerce-admin/client/header/index.js index 4f7867accb5..4f20f375e75 100644 --- a/plugins/woocommerce-admin/client/header/index.js +++ b/plugins/woocommerce-admin/client/header/index.js @@ -32,6 +32,7 @@ class Header extends Component { this.onWindowScroll = this.onWindowScroll.bind( this ); this.updateIsScrolled = this.updateIsScrolled.bind( this ); this.trackLinkClick = this.trackLinkClick.bind( this ); + this.updateDocumentTitle = this.updateDocumentTitle.bind( this ); } componentDidMount() { @@ -64,9 +65,14 @@ class Header extends Component { recordEvent( 'navbar_breadcrumb_click', { href, text: event.target.innerText } ); } - render() { + updateDocumentTitle() { const { sections, isEmbedded } = this.props; - const { isScrolled } = this.state; + + // Don't modify the document title on existing WooCommerce pages. + if ( isEmbedded ) { + return; + } + const _sections = Array.isArray( sections ) ? sections : [ sections ]; const documentTitle = _sections @@ -83,6 +89,14 @@ class Header extends Component { getSetting( 'siteTitle', '' ) ) ); + } + + render() { + const { sections, isEmbedded } = this.props; + const { isScrolled } = this.state; + const _sections = Array.isArray( sections ) ? sections : [ sections ]; + + this.updateDocumentTitle(); const className = classnames( 'woocommerce-layout__header', { 'is-scrolled': isScrolled, diff --git a/plugins/woocommerce-admin/src/Loader.php b/plugins/woocommerce-admin/src/Loader.php index aa76a45f7f0..b25e2c8f8f6 100644 --- a/plugins/woocommerce-admin/src/Loader.php +++ b/plugins/woocommerce-admin/src/Loader.php @@ -585,10 +585,7 @@ class Loader { public static function update_admin_title( $admin_title ) { if ( ! did_action( 'current_screen' ) || - ( - ! self::is_admin_page() && - ! self::is_embed_page() - ) + ! self::is_admin_page() ) { return $admin_title; }