Add/update SEO Metakeywords Programmatically Of Woocommerce Product
Could you tell me please, what is the best way to add/update SEO metakeywords programmatically?
i looked it up and found on this article how to update meta title and meta desc : https://ehikioya.com/how-to-update-yoast-seo-fields-programmatically/
when i tried to update the meta key words with the same code it wont work.
$updated_title = update_post_meta($post_id, ‘_yoast_wpseo_title’, $metatitle); //working $updated_desc = update_post_meta($post_id, ‘_yoast_wpseo_metadesc’, $metadesc); //working $updated_kw = update_post_meta($post_id, ‘_yoast_wpseo_metakeywords’, $metakeywords); // not working
I’m writing a plugin for import products and categories in WooCommerce.
I believe that Yoast SEO removed metakeywords. Searching the plugin code only title and metadesc still exist. Here is an article from Yoast explaining it Meta keywords: why we don't use them
You may instead need to try using their Focus keyword meta ie _yoast_wpseo_focuskw
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?