• When creating a page / post, WordPress automatically sets the page title as <title> tag.

    How can i prevent that?

    I found

    remove_action( 'wp_head', '_wp_render_title_tag', 1 );

    This works perfectly fine but there’s a catch.

    Now when a page is loading, it shows the whole page completely unrendered and broken. Until the page is fully loaded.

    Any Solutions for this?`

    • This topic was modified 3 years, 7 months ago by ct1601.
Viewing 1 replies (of 1 total)
  • Hi @ct1601

    You’ve asked an excellent question!

    Making sure that I’m understanding you right, you want to:

    • Remove the “Page title” (or the post title for that matter) from your Title tag
    • BUT you would still like to keep the site title in your title tag

    Did I get this right?

    The code you share removes the entire wp_head hook, which essentially removes the head section from your site, thus causing the HTML rendering to fail.

    This can be done with the help of some custom coding using the wp_head hook, similar to what you’ve attempted. But rather than that, you can use an SEO Plugin such as Yoast SEO, All in One SEO Pack, or Rankmath – all of which will allow you to edit your title tags. The other way would be to make changes to your theme template (I strongly recommend using a child theme).

    I found this article, which might guide you further on how to achieve this: https://www.seoptimer.com/blog/wordpress-page-title/

    If you’d like some help with a code snippet to fix this, let me know. I can try and conjure something for you. 🙂

Viewing 1 replies (of 1 total)

The topic ‘custom title-tag’ is closed to new replies.