Created
August 26, 2015 18:23
-
-
Save proframework/e84770458c4f17b6ea64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('admin_init','pro_convert_seo_values'); | |
function pro_convert_seo_values() | |
{ | |
$args = array( | |
'post_status' => 'publish', | |
'posts_per_page' => -1, | |
'post_type' => 'page' | |
); | |
$posts = get_posts($args); | |
foreach ( $posts as $post ) { | |
// Old values | |
$oldseo = get_post_meta($post->ID, '_custom_meta2', true); | |
$title = $oldseo['fl_meta_title']; | |
$desc = $oldseo['fl_description']; | |
$keywords = $oldseo['fl_keywords']; | |
// Update new values with old values | |
update_post_meta($post->ID, '_yoast_wpseo_title', $title); | |
update_post_meta($post->ID, '_yoast_wpseo_metadesc', $desc); | |
update_post_meta($post->ID, '_yoast_wpseo_metakeywords', $keywords); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment