Support

Account

Home Forums ACF PRO ACF Post Object field is unable to handle posts with custom post statuses

Solved

ACF Post Object field is unable to handle posts with custom post statuses

  • Hi, ACF Support team.

    I was using the ACF Post Object field to select a post whose status is a custom one that I’ve registered, but it seems that if a post with a custom status is selected, the entry will be registered on the database correctly (I mean, the post ID), but on the WP Admin it won’t appear (it disappear after saving/updating the post), so on the frontend side is like the field was not filled in. With native statuses (publish, draft, future, etc.) it seems to be working flawlessly. I’m attaching some screenshots to help you guessing the origin of the issue.

    May you help me with this issue, please? Thank you very much in advance.

    Kind regards.

  • I’ve researched a bit about this and I think the issue is related to the line 1307 of the file /includes/api/api-helpers.php (plugin version 5.12.3). This line says:
    'post_status' => 'any', and it doesn’t allow you to change it via filters. Is there a way to change it to another value in order to force it to accept custom post statuses?

  • Yep, the developers are aware of this and they are working on a way to allow it to be filtered. Until then please see this topic where I posted a work-a-round https://support.advancedcustomfields.com/forums/topic/get_field-related_posts-only-publish-posts/

  • Thank you very much for pointing out that topic. For now, this workaround is enough to solve the problem.

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

You must be logged in to reply to this topic.