Filter WordPress Media Library items by Post

Simple plugin that allows users to filter the list of images in the WordPress Media Library by the post that they are attached to.

Filter WordPress Media Library items by Post

This is a simple plugin, built to fill a gap in the WP admin, which allows a user to see which posts have attachments ( and how many ) and to filter the list of media attachments shown to one specific post ( can be a post, page or any custom post type ).

There is only one configuration option – a filterable value for the post_types to show in the dropdown filter- here is an example usage:

\add_filter( 'q/filter_media_library_by_post/post_type', function(){ return [ 'post', 'custom_post_type' ]; });

The plugin is hosted on GitHub where it can be forked:

Screen grab of the added filter:

That’s it – happy coding 🙂

Gist List
Get the Gist of things
Read the Comments
Open on github


No comments on this article yet.

Add a Comment

Your email address will not be published.

These HTML tags work: <a href=""> <code> <strong> <pre>


Our Services
Validate your ideas before diving in. Consultancy
Dig deep, audit your data, prepare for action Discovery
Get everything in shape to smooth the project path. Shaping
Let us help you realize your imagination Design
Rock-solid WordPress tools, built to last. Development
Without water, the garden will not grow. Support

Quinta de Sant’Ana, Portugal
Quinta de Sant’Ana, Portugal

Quinta de Sant'Ana overlooks the picturesque village of Gradil with its cobbled streets, white washed houses and hospitable inhabitants.

Projects: View All or

Willow is a Logic~less Template Engine built for WordPress. Willow plays nicely with ACF, is quick to learn and developer-focused.

Releases: View All or