Home Forums General Issues Filter Post Object so no child pages?


Filter Post Object so no child pages?

  • I have a Custom Post Type called ‘Locations’, which also has child pages.

    I’ve created a Post Object field and filtered this by the Custom Post Type.

    BUT i want to hide the child pages from showing in the list and only show the parent Titles.

    Is this possible, if so how do I do this?

    Thanks in advance.

  • Hi @nineten!

    Check this:

    So your code should be:

    function my_post_object_query( $args, $field, $post_id ) {
        // only show parent posts
        $args['post_parent'] = 0;
        // return
        return $args;
    // filter for a specific field based on it's name
    add_filter('acf/fields/post_object/query/name=my_post_object', 'my_post_object_query', 10, 3);
  • In the Child Object I have a custom field that is a Lokup object and i’m trying … I need to create a lookup filter so that only products that belong to the facility … List all the records without filter and do a trigger level validation. … But the issue is – In “Log a Call” page, the lookup filter is working in the current call

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

The topic ‘Filter Post Object so no child pages?’ is closed to new replies.