• Resolved Ninja Joe

    (@ninja-joe)


    In my child theme’s functions.php file, I’m trying to change a page’s <title> tag:

    function custom_title() {
    return “Page Title”;
    }
    add_filter( ‘wp_head’, ‘custom_title’, 9999 );

    The code above is not changing the page’s default <title>. What am I doing wrong?

Viewing 1 replies (of 1 total)
  • Thread Starter Ninja Joe

    (@ninja-joe)

    Got it. I need to use the document_title_parts not wp_head:

    function custom_title($title_parts) {
    $title_parts[‘title’] = “Page Title”;
    return $title_parts;
    }
    add_filter( ‘document_title_parts’, ‘custom_title’ );

Viewing 1 replies (of 1 total)
  • The topic ‘Change Page Title’ is closed to new replies.