Home › Forums › Backend Issues (wp-admin) › Backend shows information only of own user › Reply To: Backend shows information only of own user
So the linked post talks about limiting the results of post relationship custom field objects. This loop can be accessed and modified via AJAX hook path like so:
function my_post_object_query( $args, $field, $post )
{
// modify the order
$user_id = get_current_user_id();
$args['author'] = $user_id;
$args['post_type']="business";
// uncomment and test to see all set arguments:
// echo '<pre>'.print_r($args, true).'</pre>';
return $args;
}
// filter for every field
add_filter('acf/fields/post_object/query', 'my_post_object_query', 10, 3);
Since post relationship field results can be updated dynamically, this should let you restrict the results for every updated display. This particular example limits the results in two ways: by post type “business” and also by current user!
This is a pretty handy little snippet, I’m hanging on to this guy.
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.