wordpress - Automatic Update all posts at once -
i made changes in plugin creates meta boxes, added tome default code "value" of meta box. data being sent outside. problem need press "update" on every woocommerce product permanently saved , sent. have 1500 products.
i have tried bulk updating general admin area, shawn here: https://bobwp.com/bulk-edit-posts-wordpress/
it didn't work. tried code:
$args = array( 'posts_per_page' => 1000, 'post_type' => 'product' ); $the_query = new wp_query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); $casa_id = $post->id; update_post_meta($post->id, 'casa_id', $casa_id); } }
and this:
function woo_zap_update_product_name() { if ( ! is_admin() ) { return; } $zap_query = new wp_query( array( 'post_type' => 'product', 'posts_per_page' => -1 ) ); if ( $zap_query->have_posts() ) { global $post; while ( $zap_query->have_posts() ) { $zap_query->the_post(); update_post_meta( $post->id, '_wc_zap_product_name', $post->post_title ); } wp_reset_postdata(); } } add_action( 'init', 'woo_zap_update_product_name' );
didn't work well.. other ideas ?
Comments
Post a Comment