Skip to content

Instantly share code, notes, and snippets.

@d0ky
Created October 10, 2016 02:28
Show Gist options
  • Save d0ky/cd3c5183339210379d1987006db9f9e4 to your computer and use it in GitHub Desktop.
Save d0ky/cd3c5183339210379d1987006db9f9e4 to your computer and use it in GitHub Desktop.
<?php
echo'<pre>';
// Include the wp-load'er
include('wp-load.php');
$query = new WP_Query( array( 'post_type' => 'portfolio_page', 'posts_per_page' => '-1' ) );
while ($query->have_posts()) : $query->the_post();
$ids="";
$ids = get_post_meta($post->ID, 'qode_portfolio-image-gallery');
//print_R( $ids );
if ($ids[0]!='') {
$my_post = array(
'ID' => $post->ID,
'post_content' => $post->post_content." [gallery ids=\"".$ids[0]."\"]"
);
// Update the post into the database
wp_update_post( $my_post );
echo 'update product ID '.$post->ID;
}
endwhile;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment