Woocommerce – Bulk Add Focus Keywords

#49037
  • Hi Guys,
    I have a price comparison website with around 20k products on my database. Is there any way to bulk add focus keywords using product title as reference?

    I would like to do this way:

    focus keyword1: title of the product
    focus keyword2: buy + title of the product
    focus keyword3: title of the product + price

    And if possible, remove special characters like @ – ! : from the keyword

    I am using Datafeedr plugin and WP ALL Import to add the products to Woocommerce

    Thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • Alberto
    Rank Math business

    Hello,

    It is not an option inside the Rank Math settings, you can achieve it by using our API Hooks for developers.

    A few days ago a shared on this thread a similar code that you could modify to fit your needs, this one:

    function update_focus_keywords() {
    	$posts = get_posts(array(
    	'posts_per_page'	=> -1,
    	'post_type'		=> 'product' // With this we get only the products (WooCommerce)
        ));
    	foreach($posts as $p){
    		$term = get_the_title($p); // With this we get the product title
    		update_post_meta($p->ID,'rank_math_focus_keyword',$term);
    		
    	}
        
    }
    add_action( 'init', 'update_focus_keywords' );

    Looking forward to help you.

    • This reply was modified 4 years, 6 months ago by Alberto.

    Appreciate Alberto,
    I am going to try this and reply back ASAP.

    Todd
    Rank Math free

    Hi,

    It sounds great.

    Let us know how it goes.

    This worked for me. I have over 400 products and it worked. My question now:

    Must I visit every page to update the Keyword and show the SEO score?

    Will this still reflect online even if I don’t update every individual product?

    Thanks!

    Alberto
    Rank Math business

    Hello,

    To answer your first question, yes, you will need to visit them since the score calculation needs to execute some Javascript files, that is why you will need to visit them.

    But to answer your second question, yes, it will reflect online even not updating each product.

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

The ticket ‘Woocommerce – Bulk Add Focus Keywords’ is closed to new replies.