Created
March 15, 2019 16:23
-
-
Save albionselimaj/d79f6ecfa594ec566e98a3f5afafc09f to your computer and use it in GitHub Desktop.
bulk assign listing type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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