Skip to content

Instantly share code, notes, and snippets.

@twentyfortysix
Created May 14, 2017 16:15
Show Gist options
  • Save twentyfortysix/47b351cd06d816258c641abe45dfffe0 to your computer and use it in GitHub Desktop.
Save twentyfortysix/47b351cd06d816258c641abe45dfffe0 to your computer and use it in GitHub Desktop.
WP - bulk update post meta
<?php
function _run_once(){
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'place'
)
);
foreach($posts as $p) :
// $meta = get_post_meta($p->ID, 'advertiser_type',true);
//remove the meta key
update_post_meta( $p->ID, 'advertiser_type', 0, '' );
endforeach;
}
// _run_once();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment