Duplicated <title> tag #34106
Comments
EDIT: Seems another member was able to remove / comment the lines and the issue went away - I tested across multiple browsers, but I'm going to assume that my experiment below is caused by caching or local being weird. Referencing conversation happening in #core-editor slack about this. TT1 Blocks Testing The viewport meta tag is also being repeated when a wp_template CPT is loaded, not just the title tag.
Removed lines 94-100 in GB template-loader.php:
Reloaded plugin, the same error occurs when saving a brand new template (saved a new one in case the old edited file did not re-render on plugin code change). It appears like there is another file / call somewhere that is causing the duplication. |
It looks like it's an issue with how the same functionality is handled in the plugin to bridge older versions of WordPress. Related part here that uses gutenberg/lib/full-site-editing/template-loader.php Lines 98 to 100 in 0028d20 In the WordPress core it's handled with The simplest approach would be to remove the |
Technically, couldn't the polyfill be as simple as a WP Version check in the template loader in GB? |
Sure, the usual approach used in the plugin is to check if the function is defined, so here if there is no |
That makes sense, at scale version tracking for different functions would become a nightmare over updates. |
rufus87 commentedAug 17, 2021
Description
There is a great possibility to overwrite templates in FSE mod. But as soon as any template is overwritten and it content is served from database, <title> tag rendered in is duplicated, because there are 2 actions callbacks wit different names attached to 'wp_head' action:
add_action( 'wp_head', '_block_template_render_title_tag', 1 );
inwp-includes/block-template.php
line 84add_action( 'wp_head', 'gutenberg_render_title_tag', 1 );
inwp-content/plugins/gutenberg/lib/full-site-editing/template-loader.php
line 100this happens only if FSE theme template is edited and saved in FSE mod in database.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
No response
Pre-checks
The text was updated successfully, but these errors were encountered: