Home Forums ACF PRO Link query args


Link query args

  • My site has a private custom postype for users can create hidden they research posts. I am using acf/fields/post_object/query to filter query they onw private posts. To simple, I want to use “Link” intead “Post object” field, but “Link” will not show private posts. How can i modify $args for links query?
    EX code:

    function acf_link_query($args, $field, $post_id ){
        if(get_post_type($post_id) != 'hidden-research')
            return $args;
        global $user_ID;
        $args['author'] = $user_ID; 
        $args['post_type'] = 'hidden-research';
        $args['post_status'] = 'private';
        return $args;
    add_filter('acf___link___query___hook', 'acf_link_query', 10, 3);
  • If you use Page Link, you can then see all content. You can even filter out what to show or not. It’s not a simple as a button but a dropdown and allows for multiple selection.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Link query args’ is closed to new replies.