How to auto setup focus keyword as tag title

#41636
  • Resolved Raghu M
    Rank Math free

    Hi, may in know-how to auto set up focus keywords as my tag’s tile as I have more growing tags so updating manually is difficult, awaiting for a reply.

    • This topic was modified 4 years ago by Raghu M.
Viewing 6 replies - 16 through 21 (of 21 total)
  • Raghu M
    Rank Math free

    Hi Good Morning Michael Davis, I tried the above-mentioned code to use posts title as focus keyword but had no lock, didn’t worked for me, I tried placing code in the top * bottom of function.php.

    Michael Davis
    Rank Math pro

    Hi Raghu,

    Thanks for the follow up.

    Please test the following code, it works on my end:

    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){
    		$primary_term = get_post_meta($p->ID,'rank_math_primary_category', true);
    		$term = get_term($primary_term, 'category');
    		update_post_meta($p->ID,'rank_math_focus_keyword',$term->name);
    		
    	}
        
    }
    add_action( 'init', 'update_focus_keywords' );

    I hope this helps. Thank you.

    Raghu M
    Rank Math free

    Hi good morning, I tried with the new code you provided but still it’s not working and request you to please find the video link for your reference. Thanks

    https://www.loom.com/share/0316eee3253b41cba2533b893b21366e

    Michael Davis
    Rank Math pro

    Hi there,

    Thank you for the reply.

    This is probably not working since you are using a custom post type and a custom taxonomy.

    We might need to take a closer look at the settings. Please edit the first post on this ticket and 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.

    Raghu M
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Michael Davis
    Rank Math pro

    Hi Raghu,

    Thanks for the reply.

    It looks like there is a conflict on your site that is affecting the selection of the primary term feature.

    My efforts to identify the culprit using the Health check and troubleshooting plugin unfortunately did not bear fruit. I can suggest that you manually disable plugins to identify the culprit.

    Let us know how this goes. Thank 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 - 16 through 21 (of 21 total)

The ticket ‘How to auto setup focus keyword as tag title’ is closed to new replies.