You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a generalised PostPicker component to allow selecting post(s) from a modal #71128
Related to the idea of a new media library in Phase 3 of Gutenberg (#55238) but also useful in its own right:
What problem does this address?
Add a PostPicker component that can be used to display a modal for selecting one or many posts. It could use DataViews (or similar componentry) and also form the basis for a media library in a modal, too.
Potential uses
A modal for selecting page parents
Selecting patterns
A modal for selecting links to existing posts or pages (especially on large sites)
Create a PostPicker component that implements this for selecting a post or page
In terms of how it might look, I imagine it could look quite similar to the Pages screen in the site editor, but with a button at the bottom right to "Select" rather than an "Add Page" button at the top right. For patterns or media, it might default to the Grid layout instead, though.
For a reference point in the core wp-admin areas, there's currently a simple modal available for the "attach to" behaviour of the media library. It looks like this:
I've started a proof of concept in #73710 that seeks to output a single modal and expose a function that allows consumers to open and configure that modal (and pass in an onSelect). The PR is very much a vibe-coded proof of concept, but I think demonstrates that it can work, and be quite lean from the perspective of consumers e.g. fields like parent.
It would be nice to be able to pass query arguments or allow the user to set the arguments beyond just the post type. I am thinking of options like taxonomy term filters or custom filters like a ToggleControl for if the post has a thumbnail assigned.
Also, is there a version of this for assigning post order, perhaps with drag-and-drop?
It would be nice to be able to pass query arguments or allow the user to set the arguments beyond just the post type.
Absolutely! I haven't started looking at what the API surface might be for this one, but I imagine it'd need to support all the different kinds of params that the PHP-equivalent posts or pages lists support, so that the modal could be invoked with filters, sorting, etc already applied. It'd be good to get an idea of the kind of shape that might be.
Also, is there a version of this for assigning post order, perhaps with drag-and-drop?
That's a cool idea — for this particular issue, I was imagining the PostPicker modal would be exclusively for picking an item rather than as an interface for rearranging page order. Though, that's also something that could do with improving as the current "order" modal isn't very intuitive for this. Perhaps assigning page order would be part of the overall pages list, rather than within the PostPicker 🤔
Also, just for context, I've only been hacking on this idea a little bit in my spare time in and around other tasks, so I may or may not be able to advance much of this work in the short-term, as I'm focused on other things. I would very much like to see this post picker modal happen, though!
Activity
ramonjd commentedon Nov 9, 2025
Also see this issue for design reference:
andrewserong commentedon Dec 3, 2025
I've started a proof of concept in #73710 that seeks to output a single modal and expose a function that allows consumers to open and configure that modal (and pass in an
onSelect). The PR is very much a vibe-coded proof of concept, but I think demonstrates that it can work, and be quite lean from the perspective of consumers e.g. fields likeparent.dannyreaktiv commentedon Dec 3, 2025
It would be nice to be able to pass query arguments or allow the user to set the arguments beyond just the post type. I am thinking of options like taxonomy term filters or custom filters like a ToggleControl for if the post has a thumbnail assigned.
Also, is there a version of this for assigning post order, perhaps with drag-and-drop?
andrewserong commentedon Dec 8, 2025
Absolutely! I haven't started looking at what the API surface might be for this one, but I imagine it'd need to support all the different kinds of params that the PHP-equivalent posts or pages lists support, so that the modal could be invoked with filters, sorting, etc already applied. It'd be good to get an idea of the kind of shape that might be.
That's a cool idea — for this particular issue, I was imagining the PostPicker modal would be exclusively for picking an item rather than as an interface for rearranging page order. Though, that's also something that could do with improving as the current "order" modal isn't very intuitive for this. Perhaps assigning page order would be part of the overall pages list, rather than within the PostPicker 🤔
Also, just for context, I've only been hacking on this idea a little bit in my spare time in and around other tasks, so I may or may not be able to advance much of this work in the short-term, as I'm focused on other things. I would very much like to see this post picker modal happen, though!