• Resolved candell

    (@candell)


    Title tag support is set in the functions.php file

    add_theme_support( 'title-tag' );

    The site uses the Yoast SEO plugin for the majority of pages, however one of the page templates I want to override this and provide my own titles.

    On the template page I add

    add_filter('pre_get_document_title', 'custom_title');
    function custom_title($title) {
         return 'Test New Title';
    }

    But the title isn’t changing.

    Can anyone lend a hand?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is that code in the template file itself? Is it before the header is called?
    You probably need to adjust the priority for the filter, so that it runs after Yoast does. The default is 10. Either ask at the plugin’s support forum, or read their code to see at what priority their code runs.

    Thread Starter candell

    (@candell)

    Hi Joy

    It was the priority, thank you for the suggestion ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Modify title tag on specific template’ is closed to new replies.