Open function.php and paste this code


$post_list = get_posts( array(
'posts_per_page' => 500,
) );

$posts = array();

foreach ( $post_list as $post ) {
function_remove_images($post->ID);
}

function function_remove_images($post_id) {
global $wpdb;
$contentquery = “SELECT post_content
FROM $wpdb->posts
WHERE $wpdb->posts.ID = $post_id”;
$original_content = $wpdb->get_var($contentquery);

$captions_stripped = preg_replace(‘/<img[^>]+./’,”, $original_content);
//print_r($captions_stripped);
$newcontent = mysql_real_escape_string($captions_stripped);
$contentquery = “UPDATE $wpdb->posts
SET post_content = ‘$newcontent’
WHERE $wpdb->posts.ID = $post_id”;
$update_content = $wpdb->query($contentquery);
}