[wp-trac] [WordPress Trac] #61900: Unable to remove hook to display title tag in block theme
WordPress Trac
noreply at wordpress.org
Tue Aug 20 14:34:25 UTC 2024
#61900: Unable to remove hook to display title tag in block theme
-----------------------------+-----------------------------
Reporter: webbingstudio | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.6
Severity: normal | Keywords: needs-docs
Focuses: template |
-----------------------------+-----------------------------
As a simple SEO measure, there was a customization to remove the
"_wp_render_title_tag" hook and then output an arbitrary title tag. There
are also plugins that use this function.
Example: If you execute the following code, it is expected that the
default title tag will no longer be output.
{{{#!php
<?php
add_action( 'init', 'mytheme_render_title_tag', 1 );
function mytheme_render_title_tag() {
remove_action( 'wp_head', '_wp_render_title_tag', 1 );
}
}}}
However, currently, the "_wp_render_title_tag" hook cannot be disabled in
block themes. The default title tag remains output, and as a result, the
title is displayed twice.
Is this expected behavior? If it is, could you please add an announcement
that the hook can no longer be used and a document that describes how to
deal with it in block themes?
*Of course, I understand that it is not desirable to directly interact
with internal functions that start with an underscore.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61900>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list