I’m regularly using the post object field to create relationships to other posts on the site.
At the moment, the default “posts” post type is the first that is displayed in the list, ahead of ‘pages’ and other custom post types. Usually when creating post object relationships, it will be to a page or to a custom post type. It’s rare that I’ll be selecting the default post type, which will generally be used for blog posts.
The problem I’m experiencing is that on larger sites it’s time consuming to scroll past the many blog posts to find the page or custom post I need, even when adding a search term (as quite often there will be many blog posts containing the name of the page/custom post I’m looking for)
I think it would be an improvement to have the pages & custom posts listed before the standard post type in the dropdown.
This function does not have any arguments to specify how they should be ordered. Basically WP just returns the contents of the global variable $wp_post_types filtered to only show specific post types based on other arguments. The global value is an array of post types in the order that they are created.
I did some digging in WP and there isn’t any way to filter this that I can find.
Even when selecting the post types when creating the field, the same thing is done.
At some point before ACF accesses the post types, access the WP global variable and reorder the array of post types to the order you want them returned.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users