Support

Search results for ""

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

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

7 years, 5 months ago
Nohemi

Ok, thank you.

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

7 years, 5 months ago
Stefan van den Dungen Gronovius
Developer

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, 5 months ago
Nohemi

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 : https://www.admincolumns.com/forums/topic/validate-acf-field/

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

7 years, 5 months ago

You must be logged in to reply to this topic.