Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Sync post meta to Yoast Indexable
* Credit: Yoast team
* Last Tested: Jun 11 2020 using Yoast SEO 14.3 on WordPress 5.4.2
*/
// The ID of the post to modify
$post_id = 1;
// The post meta to modify
update_post_meta( $post_id, $key = '_yoast_wpseo_focuskw', $value = 'Custom focus keyphrase' );
update_post_meta( $post_id, $key = '_yoast_wpseo_metadesc', $value = 'Custom description' );
// Update post to sync from post meta to yoast indexable
$my_post = array(
'ID' => $post_id
);
wp_update_post( $my_post );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.