Hi
Could please tell me how to add or update SEO Focus keyphrase programmatically?
I used this code but it doesn’t work:
1 2 3 | $myFocusKeyword = "focus keyword example"; $updatedKeyword = update_post_meta($post_id, ‘_yoast_wpseo_metakeywords’, $myFocusKeyword); |
Please do you have any idea?
thanks
Hi,
I think Yoast SEO removed metakeywords. Please see this aricle :
Meta keywords Why we don’t use them – and neither should you
use this key instead :
You can update it like any post meta. This is the syntax:
I tested it and it works fine.
regards
Hi,
Thanks a lot. worked as expected.
If anyone is interested to write to metadescription, you can use this code:
Have a nice coding 😉