Skip to content

Instantly share code, notes, and snippets.

@albionselimaj
Created March 15, 2019 16:23
Show Gist options
  • Save albionselimaj/d79f6ecfa594ec566e98a3f5afafc09f to your computer and use it in GitHub Desktop.
Save albionselimaj/d79f6ecfa594ec566e98a3f5afafc09f to your computer and use it in GitHub Desktop.
bulk assign listing type
add_action( 'init', function() {
if ( empty( $_GET['bulk-assign-type'] ) || ! current_user_can( 'administrator' ) ) {
return;
}
$listing_type = 'event'; // modify this
$listings = (array) get_posts( [
'post_type' => 'job_listing',
'posts_per_page' => -1,
'post_status' => 'any',
] );
foreach ( $listings as $listing ) {
update_post_meta( $listing->ID, '_case27_listing_type', $listing_type );
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment