Support

Account

Home Forums Backend Issues (wp-admin) Page Link field type

Solved

Page Link field type

  • Hi, I updated the plugin and now the Page Link field type is a bit broken. It doesn’t display pages at all. All the pages are published and working individually and the field type was working before the plugin was updated.

    Any ideas?

  • I’m having the same problem with page links and post object fields. I’ve done some testing and it looks like the problem has to do with the ‘post_status’ argument being set to “any” in the the get_pages() query.

    I put this line of code into my functions.php to solve the problem until a more formal bugfix is released.

    function fix_acf_post_query($args,$field) {
    $args[‘post_status’] = ‘publish’;
    return $args;
    }
    add_filter(‘acf/fields/post_object/query’,’fix_acf_post_query’,10,2);

    Keep in mind, it’ll restrict your page links to pages that are published.

  • Thank you very much! Problem Solved.

  • Oh, forgot, return $args;

    function fix_acf_post_query($args,$field) {
    $args[‘post_status’] = ‘publish’;
    return $args;
    }

  • Hi guys

    Sorry about this bug. It seems the get_pages function is not very smart an doesn’t understand the same $args for get_posts…

    I have just tracked down and fixed the issue. You can find the latest code on github, or wait for the next version to be released (soon).

    Thanks
    E

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

The topic ‘Page Link field type’ is closed to new replies.