Created
September 29, 2016 04:34
-
-
Save Musilda/d55c6a84ff0e36d271ea5171b8308ab6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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', 'set_virtual' ); | |
function set_virtual(){ | |
$args = array( | |
'post_type' => 'product', | |
'posts_per_page' => -1 | |
); | |
$products = new WP_Query( $args ); | |
var_dump(count($products->posts)); | |
foreach( $products->posts as $item ){ | |
update_post_meta( $item->ID, '_virtual', 'yes' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment