Bulk Add Focus Keyword.

#626762
  • Resolved Anonymous
    Rank Math free

    I used the chat bot and following the following information but nothing seemed to work/change.

    Me: I have 1,000 posts. I have the keyword in the title like “Keyword: interesting title” how can I insert the keyword but not the interesting title?

    Bot: To insert the keyword without including the interesting title in your post, you can follow these steps:

    Navigate to your WordPress Dashboard.
    Go to “Appearance” and select “Theme File Editor” (for a Classic Theme) or “Tools” and select “Theme File Editor” (for a Block Theme).
    In the code editor, locate your theme’s functions.php or rank-math.php file. It is usually located in the /wp-content/themes/theme-name/ directory.
    Add the following code snippet to the chosen file:
    add_filter( ‘rank_math/frontend/title’, function( $title ) {
    // Extract the keyword from the title
    $keyword = preg_replace( ‘/Keyword: (.*)/’, ‘$1’, $title );

    // Return only the keyword
    return $keyword;
    });
    Click on the “Update File” button to save the changes.
    This code snippet will extract the keyword from the title and display only the keyword in your post. Make sure to replace theme-name with the actual name of your theme.

    If you encounter any issues or need further assistance, I recommend reaching out to the Rank Math support team by opening a support ticket here. They will be able to provide you with more specific guidance based on your website setup.”

    I followed the instructions given above. Below in the Sensitive data section is the function.php file. Line 12 to 18 is related to Rankmath.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you so much for getting in touch.

    There are two ways that this can be done.

    The first one is to manually bulk-edit the pages and add them by using the Bulk Editing feature on our plugin. You can access this feature from WordPress Dashboard > Posts > All Posts or WordPress Dashboard > Pages > All Pages. You can also filter the posts and pages by various criteria, such as post type, category, tag, etc. You can learn more about how to use the Bulk Editing feature here:
    https://rankmath.com/kb/bulk-editing-in-rank-math/

    The second one is you can use a code snippet to automatically set the post title or the post tags as the focus keywords for your posts and pages. You will need to add the code snippet to your theme’s functions.php or rank-math.php file. You can find the code snippets and instructions here:
    https://rankmath.com/kb/how-to-automate-the-insertion-of-focus-keyword/

    If you don’t have a rank-math.php file, this can help instead:
    https://rankmath.com/kb/filters-hooks-api-developer/#how-to-add-code-snippets-to-rank-math-php

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

    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.

Viewing 1 replies (of 1 total)

The ticket ‘Bulk Add Focus Keyword.’ is closed to new replies.