Skip to content

Instantly share code, notes, and snippets.

@jcasabona
Created August 24, 2020 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcasabona/3f7406e1813543eea595d4e24cd3ea28 to your computer and use it in GitHub Desktop.
Save jcasabona/3f7406e1813543eea595d4e24cd3ea28 to your computer and use it in GitHub Desktop.
<?php
function convert_fm_to_acf() {
$args = array(
'posts_per_page' => -1,
'post_type' => 'post',
);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) {
$the_query->the_post();
$old_t = get_post_meta( get_the_ID(), 'wpp_episode_transcript', true );
$old_s = get_post_meta( get_the_ID(), 'wpp_episode_sponsor', true );
update_field( 'hibi_episode_sponsor', $old_s, get_the_ID() );
update_field( 'hibi_transcript', $old_t, get_the_ID() );
}
wp_reset_postdata();
}
add_action( 'admin_init', 'convert_fm_to_acf' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment