Custom Function for Term & Category

#98497
  • Resolved Matt McKenna
    Rank Math free

    Hello, I have categories with States as the Parent Category and Cities for each state as Child Categories. For the city page titles, I would like them to include “City, State” I know I can do %term%, %category% – however – for the states there will only be %category% so there will be “, State” since there is no %term%

    In other words, is there any function I can use to hide the “, ” if there the %term% tag is empty?

    Thanks!

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    [I am sorry but there is no such a function currently available. You can however customize and use th following filter to modify your titles:

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

    Hoping this helps you. Thank you.

    ​​​​​​​

    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 1 replies (of 1 total)

The ticket ‘Custom Function for Term & Category’ is closed to new replies.