Support

Account

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.