Post Title As Focus Keywords

#88613
  • Resolved Emmanuel Kuebu
    Rank Math free

    Please how do I auto-set post title as focus keywords? My site has user-generated content and I would love that, when they upload any post, the focus keyword is set automatically (from the post title) after they publish the post. I already have over 400 posts on the site, for some, I have already set the focus keywords but of many, I have not. I would like to have them set automatically too. Thanks for helping in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    Thank you for getting in touch with us.

    I am sorry but Rank math doesn’t have a feature to automate this. You can however modify the following filter to get the title of the post then assign it as the keyword for your posts:

    /**
     * Allow changing the meta keywords from the default Focus Keywords.
     *
     * @param string $keywords Keywords.
     */
    add_filter( 'rank_math/frontend/keywords', function( $keywords ) {
     return $keywords;
    });
    

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

    Could you please help with the modification? I don’t know php. Thank you

    Hello,

    Please include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    I have added the code to my functions.php in my child theme. How do I check if its working. Will this set the keyword for older posts too?

    “You can, however, modify the following filter to get the title of the post then assign it as the keyword for your posts:”

    He asked me to modify the code he shared to before it does what I want. I was asking for help with the modification of the code. Do you still need account access to do that?

    Alberto
    Rank Math business

    Hello,

    You can try this code:

    /**
     * Allow changing the meta keywords from the default Focus Keywords.
     *
     * @param string $keywords Keywords.
     */
    add_filter( 'rank_math/frontend/keywords', function( $keywords ) {
     return the_title();
    });

    Looking forward to help you.

    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 6 replies - 1 through 6 (of 6 total)

The ticket ‘Post Title As Focus Keywords’ is closed to new replies.