1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php /** * Hromadná změna meta_value */ function bunch_meta_value_update($post_type = null, $posts_per_page = -1, $meta_key = null, $meta_value = null) { $args = []; $args['post_type'] = $post_type; $args['posts_per_page'] = $posts_per_page; $posts = get_posts($args); foreach ($posts as $post) { update_post_meta( $post->ID, $meta_key, $meta_value); } } bunch_meta_value_update('turnaj', -1, 'zobrazit_v_archivu', 1 );
You can clone a snippet to your computer for local editing. Learn more.