Hello,
Thank you for contacting Rank Math support and we apologize for the inconvenience.
One way to achieve this with Rank Math is to use a filter to override Rank Math’s title and description for that specific page. Here are the steps:
To use a filter to override Rank Math’s title and description, you will need to add some custom code to your child theme’s functions.php file or use a plugin like Code Snippets to insert it.
You can use the rank_math/frontend/title
and rank_math/frontend/description
filters to change the title and description programmatically. You can find more information about these filters here: https://rankmath.com/kb/filters-hooks-api-developer/#change-the-title and https://rankmath.com/kb/filters-hooks-api-developer/#change-meta-description
To use these filters, you will need to add a condition that checks if the current page is the one that you want to exclude, and then return your custom title and description. For example, if your page slug is ‘lutador’, you can use this code:
Meta Title:
add_filter( 'rank_math/frontend/title', function( $title ) {
if ( is_page( 'lutador' ) ) { //check if the current page is 'lutador'
global $fighter; //get the global variable $fighter
return $fighter['name']; //return the custom title
}
return $title; //return the original title
});
Meta Description:
add_filter( 'rank_math/frontend/description', function( $description ) {
if ( is_page( 'lutador' ) ) { //check if the current page is 'lutador'
global $fighter; //get the global variable $fighter
return 'Saiba todas as informações do lutador ' . $fighter['name'] . ', o ' . $fighter['nick_name'] . '. + custom description'; //return the custom description
}
return $description; //return the original description
});
These are of course just examples, you’ll need to customize the filter to work for your specific need. You can learn how to add filters to your site here: https://rankmath.com/kb/wordpress-hooks-actions-filters/
We hope this helps. If you have any other questions or concerns regarding Rank Math, please feel free to contact us again. We are always happy to help.
Thank you for choosing Rank Math!