I saw in the changelog for 4.3.4:
Post Object field: Fixed get_pages bug cuasing ‘pages’ to not appear
However, on a site running 4.3.4 I have exactly this problem with a “page” and custom post_type select – they are empty and give no JS errors.
The only possible PHP error in the log is this – but I’m not certain it’s connected ( the page loads fully – so I doubt it’s recovered from a Fatal error.. ):
[20-Jan-2014 17:24:09 UTC] PHP Fatal error: Call to a member function get() on a non-object in /path/to/files/html/wp-includes/cache.php on line 113
Any help would be gratefully received!
Thanks for providing us with this essential tool 🙂
I’ve been trying to find the source of this bug for a week now – and it’s driving me a little crazy.
There are NO JS errors – nothing in the PHP Error log.. and on some screens the selects load fine – for example new page or add new custom post type.
But – on the new post screen I can’t get it to load a “Post Object” that shows either pages or a custom post type – other field types like “Taxonomy” are working fine and normally on all views.
What more – on my localhost install – this all works fine on all views – same version – my localhost copy has an older version of the site content and possibly one or two plugins different – but I tried to disable those on the list site and it made no obvious difference.
I’ve tried adding new ACF groups and breaking the options up / re-ordering and removing certain fields – but the result is the same – an empty select for the field type “Post Object” on the new post screen.
What more can I try?
I should mention – I got the custom post type “Post Object” select to work by filtering the items shown – I selected all the terms in a certain taxonomy and this allowed the select to include all the posts in that custom post type.
I’ve been trying to add a taxonomy to pages to do the same – but so far, it’s not working because ACF does not recognise the “page_tags” taxonomy that I’ve added.
Sorry – one more update.
If I select a field type “Page Link” it also returns an empty select – so I’m guessing that something in the content ( title ) of one of the pages is throwing ACF out – but that would not explain why I can view pages on other screens – such as New Page?
Also – if I select a “Post Object” field type – but do not filter the results by post type – instead select “All” – no pages appear in the select options on the New Page screen ( it lists all other posts in all other post_types ) – they do however appear in all other screens.
It is possible that you have a large amount of posts in the DB, and because the current post_object field is not efficient, it is failing to query all the pages form the DB.
This has been fixed in ACF5 (soon to be released), but it may also be another issue entirely.
You said that the issue only happens on the live site, not local? This points to the issue being a DB load problem.
If you want, I can log into your site, and if you give me access to edit plugins, I can do some debugging in the post_object field to find the issue?
Thanks for getting back to me.
Your suggestion sounds about right – but I don’t understand why on some pages the field types are loading normally – I have Query Monitor plugin installed and this informs me of slow or heavy queries – and it does not complain at all.
I have put in place a temporary fix ( manually re-creating the selects from the data ) – this is good enough for a few weeks – when is V5 due out – I’d be happy to wait?
Great news – thanks!
By the way – when you get time ( I know that might be a while ! ) – please take a look at this number slider field type plugin for ACF – any feedback would be warmly welcomed!
The topic ‘V4.3.4 – Post Object selects empty’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2023 Advanced Custom Fields.