Skip to content

Add a generalised PostPicker component to allow selecting post(s) from a modal #71128

Open

Description

@andrewserong

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

What is your proposed solution?

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.

Image

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:

Image

Related issues

Activity

  1. added
    [Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond
    on Aug 8, 2025
  2. ramonjd commented on Nov 9, 2025

    @ramonjd
    Member

    Also see this issue for design reference:

  3. andrewserong commented on Dec 3, 2025

    @andrewserong
    ContributorAuthor

    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.

  4. dannyreaktiv commented on Dec 3, 2025

    @dannyreaktiv

    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?

  5. andrewserong commented on Dec 8, 2025

    @andrewserong
    ContributorAuthor

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions