Hello,
To automatically set the post title as the focus keyword for your posts, you can use the following code snippet. You need to add this code to your theme’s functions.php
or rank-math.php
file. Here is the code snippet you can use:
/**
* Function to automatically update the focus keyword with the post title
*/
function update_focus_keywords()
{
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'post' //replace post with the name of your post type
));
foreach ($posts as $p) {
update_post_meta($p->ID, 'rank_math_focus_keyword', strtolower(get_the_title($p->ID)));
}
}
add_action('init', 'update_focus_keywords');
Please note that this code will replace all existing focus keywords with the post titles. If you only want to set the post title as a focus keyword for posts that don’t have a focus keyword set, you can use a slightly modified version of the code.
If you need further assistance or have any questions, feel free to ask!
Sources:
How to Automate the Insertion of Focus Keyword » Rank Math
How Does Search Engine Rank Tracking Work? » Rank Math

Fiz as alterações no functions.php e não surtiram efeito nas palavras chave automáticas.
também não encontrei a pasta rank-math.php
Eu posso criar uma no diretório?
Teria que ser em qual diretório?
Hello,
Thank you for your patience.
The rank-math.php file should be created under your theme files.
Please follow our guide here to apply the filter on your site:
https://rankmath.com/kb/filters-hooks-api-developer/#how-to-add-code-snippets-to-rank-math-php
Let us know how this goes.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.