[OFFER ALERT!] This Halloween, Get Any Premium Theme for Just $19 [GET IT NOW]
Jump to content

[Rank Math SEO Plugin] Can focus keyword predefined from term title of a post or anything


dhruv121006
 Share

Recommended Posts

Hi Admin, is it possible to call the product title term or product category title term as a focus keyword dynamically or can we upload meta information in bulk via csv for a woocommerce website. Also in the product category of woocommerce the seo features are less and if I give a default template for meta description from settings for product categories it is not coming on woocommerce product category in the meta description it is showing the showing the short description of it. It would be great if you help in this.

Link to comment
Share on other sites

  • Support

Hello,

Thank you for contacting MyThemeShop today.

You can use some CSV Importer plugin like WP CSV Importer to bulk update focus keyword. In CSV file use rank_math_focus_keyword in meta field column followed by the value.

Or if you want to dynamically set Product title & Product category title as Focus Keyword then you can add below code in your active theme's functions.php file:

add_action( 'init', function() {
  if( is_admin() ) {
    $products = get_posts( array(
      'posts_per_page' => -1,
      'post_type' => 'product',
      'fields' => 'ids',
      'meta_query' => array(
        'relation' => 'OR',
        array(
          'key' => 'rank_math_focus_keyword',
          'value' => '',
          'compare' => '='
        ),
        array(
          'key' => 'rank_math_focus_keyword',
          'value' => '',
          'compare' => 'NOT EXISTS'
        ),
      ),
    ) );
    foreach( $products as $product ) {
      $title = get_the_title( $product );
      update_post_meta( $product, 'rank_math_focus_keyword', $title );
    }

    $product_categories = get_terms( 'product_cat' );
    if( ! empty( $product_categories ) ) {
      foreach( $product_categories as $product_category ) {
        update_term_meta( $product_category->term_id, 'rank_math_focus_keyword', $product_category->name );
      }
    }
  }
});

After adding this code reload your WP Admin Dashboard (the update process might take time depending on the number of products you have on your site).

Please note, this method is not recommended and should be used only if you have some coding knowledge. Also, this should run only once, so remove this code immediately after the Dashboard is loaded.

For your second issue, the Meta Description you add in Setting is used as a default Meta description and is applied to the new product. If it's not working for you then please share your login details in the Sensitive Data Section as it is working fine on our setup. 

You can share your login details in the "Sensitive Data" section by editing your first post on this ticket and follow the instructions shown in the screenshot below:
sensitive.jpg

Please make a reply once you update the details, so we get notified.

Looking forward to helping you. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...