Hello,
Thank you for contacting Rank Math today.
For such a setup, you would need to modify the actual page/template file that is used to show the page. From within this file.
You can use this code to get the global meta description and set it to a global variable.
add_action( 'rank_math/frontend/description', function( $description ) {
global $post;
global $rm_meta_desc = RankMath\Post::get_meta( 'description', $post->ID );
return $description;
});
Looking forward to helping you. Thank you.
ok,
after investigating,
this page has no ID.
it’s a static page with archive-cpt.php structure in template.
it get the get_header(); hook,
so can i modify it seo settings by there ?
ps : it’s title i want to update, but thanks for the meta description info !
-
This reply was modified 5 years ago by Gregory.
Hello,
Thank you for contacting Rank Math today.
You can make use of the following filter to set a static title for the archive page. You would first need to add some logic to check the current page and map the custom title:
/**
* Filter to change the page title.
*
* @param string $title
*/
add_filter( 'rank_math/frontend/title', function( $title ) {
if($_SERVER['REQUEST_URI'] =="/page_name/"){
$title = "Custom meta title here";
return $title;
}
return $title;
});
Looking forward to helping you. Thank you.
Hello,
We are super happy that this resolved your issue. 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/?rate=5#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.