-
Hi, I have this php snippet to modify SEO title for certain posts. Is there a way to modify only Facebook/Twitter titles the same way, not SEO titles?
add_filter('rank_math/frontend/title', function ($title) { global $post; // Check if $post is not null and is a valid WP_Post object if (!is_a($post, 'WP_Post')) { return $title; // Return original title if $post is not valid } // Check if the current page is a single post and belongs to a specific category if (is_single() && has_category('videos', $post)) { // Modify the title to prepend "VIDEO: " $title = $title . " [Video]"; } return $title; });
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
You must be logged in to reply to this ticket.