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;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.