Get the SEO title
-
Hello,
I would have liked to use the SEO title of Rank Math for a plugin.
I use this code:
$seo_title = get_post_meta( $post->ID, ‘rank_math_title’, true );
if ( ! empty( $seo_title ) ) {
? ? $title = $seo_title;
} else {
? ? $title = $post->post_title;
}This works well but for titles with variables, for example: “The best programs %currentyears%”, it does not put the year.
So I have a link with the following title: The best programs %currentyears%
Instead of: The best programs 2023
Can you help me please ?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get the SEO title’ is closed to new replies.