ACF load_field filter : problem when i use global $post data
Hi,
With ACF, it is possible to use « global $post » inside the « load_field » filter : https://www.advancedcustomfields.com/resources/acfload_field/
For example :
function my_acf_load_field( $field ) {
global $post ;
if($post->post_type == ‘my_type’){
$field['choices'] = array(
'custom' => 'My Custom Choice'
);
}
return $field;
}
add_filter('acf/load_field/type=select', 'my_acf_load_field');
Thereby, i can change choices for a dropdown select (or radio/check boxes), depending of the $post.
But it doesn’t work with admin columns inline edit. Apparently, the filter is called only one time for all rows instead of one time per row. So $post is always equal to first post of the list.
Do you have a solution to have different « editability options » for each row for an acf field ?
Thank you
( Sorry for my poor English :} )
You must be logged in to reply to this topic.