Dynamic post Titles by post category?

  • I have a client that would like to modify the single post Title but only for post in one certain category (which contains several hundred post). Another way to put this, is there a way to dynamically change the single post Title based on the post Category? Changes hundreds or thousands of post titles individually is out of the question.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Thank you for contacting Rank Math today.

    You can use the following filter with some custom logic to dynamically change the titles:

    /**
     * Filter to change the page title.
     * 
     * @param string $title
     */
    add_filter( 'rank_math/frontend/title', function( $title ) {
    	return $title;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    do i add this and any related custom logic to my functions.php file?

    yes, but how can I dynamically change titles based on post “category” ? I only want to do this for all the post in one or two particular categories, not for every post in the website.

    Hi Gregg,

    Yes, you can do that with the filter we gave you above. But, we assume you know some coding while putting this filter to use.

    As much as we would love to offer customized solution to each and every user we have, it just isn’t possible for a small company like ours with limited resources. So, we will not be able to help with a custom code for a specific category.

    Another semi-automated version would be to bulk edit all the posts in the category at once with a specific variable:

    null

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The ticket ‘Dynamic post Titles by post category?’ is closed to new replies.