Changing title of dynamic page in WordPress

Does anyone know of a way to change the title of a page that is created dynamically in WordPress? The pages in question are created dynamically via a plugin, and do not appear in the list of pages or WordPress SEO in the admin section.

Here is an example of a page I would like to change the title of: http://www.forestlakechevrolet.com/inventory/New/

Read More

The inventory tool is maintaining the inventory of two dealerships, but only one is featured on this site. So it uses an SEO title based on the makes available at both dealerships.

Essentially, I am wondering if there is a function that I could add that would say “If URL is … then force page title to be ***.”

Does anyone know how to do this?

Thank you,
Jared Wilcox

Related posts

Leave a Reply

1 comment

  1. Just use the wp_title filter

    Add something like this to your theme’s functions.php file:

    <?php
    
    function assignPageTitle( $title ){
       global $post;
    
       if ($post->post_name === "test") {
          $title = "Title goes here";
       }
    
       return $title;
    }
    add_filter('wp_title', 'assignPageTitle');
    
    ?>
    

    You may also need to change your theme’s header file if the wp_title call is adding the Site Name.

    BTW, WordPress questions are better asked on https://wordpress.stackexchange.com/