head title change, if not set with rankmath

#244886
  • Resolved jnz31
    Rank Math free

    hi

    i use the filter ‘rank_math/frontend/title’ to alter the page title for a certain post type. works fine. now the client is asking for another feature of that function: if the title is set manually via rank math, it shall use the manual data, else: overwrite with my custom function.
    is there a method to get the rank math page title, so i could check if this is empty.. or do you guys even have a better idea?

    thanks in advance. best. jens

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

    Thanks for contacting us.

    You can use the modified snippet given below to check if there is a manual title or not:

    add_filter( 'rank_math/frontend/title', function( $title ) {
    	if (get_post_meta(get_queried_object_id(), 'rank_math_title', true)) {
    		return $title;
    	}
    	$title = 'Your custom title';
    	return $title;
    });

    Hope this helps. Let us know if you need any further assistance.

    jnz31
    Rank Math free

    ola jaideep

    thanks for providing the fully working solution, wasn’t expecting that!! 🙂

    Hello,

    We are super happy that we were able to help. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘head title change, if not set with rankmath’ is closed to new replies.