Support

Account

Home Forums ACF PRO acf_update_field – Passing the value to the post Reply To: acf_update_field – Passing the value to the post

  • Fixed. For past posts, the value is passed by this bulk action.

    add_filter( 'bulk_actions-edit-post', 'register_my_bulk_actions2' );
     function register_my_bulk_actions2($post_ids) {
        global $wpdb;
          $users = $wpdb->get_results( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'genere'AND meta_value = 'Maschio' " );
        foreach ( $users as $a ) {
            $author_ids[] = $a->user_id;
        }
    
       $args = array( 'posts_per_page' => -1 ,  'author__in' =>  $author_ids, );
       $myposts = get_posts( $args );
       foreach( $myposts as $post ) :
         $numero = $post->ID;
         update_post_meta( $numero, 'genere', 'Maschio' );
       endforeach; 
      }