Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics

ACF load_field filter : problem when i use global $post data


With ACF, it is possible to use « global $post » inside the « load_field » filter :

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 :} )

7 years, 6 months ago

Ok, thank you.

I will follow the request carefully because it’s really needed for my current project.

7 years, 6 months ago
Stefan van den Dungen Gronovius

Hi Nohemi,

Since you really need this feature for the current project, I would not expect this issue to be resolved any time soon. We’re currently a small team and a very many tickets to solve :)

But we’re looking for extra developers to help us develop this product. Interested?

7 years, 6 months ago

Thank for the proposition but for the moment, my job take all my time ^^.

For my problem, for the moment, i display all options for all posts and i use the acf update value filter to prevent bad values. See my other ticket :

If I have time to think about a solution, i can send you a patch ?

7 years, 6 months ago

You must be logged in to reply to this topic.