Skip to content

Instantly share code, notes, and snippets.

@d0ky
Created October 13, 2016 00:40
Show Gist options
  • Save d0ky/d794b5411629ac988e31575b44ddd1ab to your computer and use it in GitHub Desktop.
Save d0ky/d794b5411629ac988e31575b44ddd1ab to your computer and use it in GitHub Desktop.
put it wp root folder reach it by the browser once to remove all visual composer tag from your db
<?php
// put it wp root folder reach it by the browser once to remove all visual composer tag from your db
//
echo'<pre>';
// Include the wp-load'er
include('wp-load.php');
$query = new WP_Query( array( 'posts_per_page' => '-1' ) );
while ($query->have_posts()) : $query->the_post();
//print_R( $post->post_title );
$my_post = array(
'ID' => $post->ID,
'post_content' => preg_replace("/(\[(\/?)vc.*?\])/s", '', $post->post_content)
);
// Update the post into the database
wp_update_post( $my_post );
echo '<br>';
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