In the Media Library, when I go in to attach a media item to a post, I know I can use “Attach” to pull up the “Find Posts or Pages” pop up.
This brings the following list of post title, date and status.
I wonder if there is a way to have the results show the post ID as well?
It might have something to do with the find_posts_div
function, but I’m not sure how to apply the proper filters.
You cannot do that with pure PHP. The table is created in
wp-admin/includes/ajax-actions.php::wp_ajax_find_posts()
, and there is no filter.But look at the radio buttons:
You can print a script on the action
admin_footer-upload.php
that extracts the post ID from the values and adds a new column to the table.Here is a working example as a plugin. The code is not exactly beautiful, but it works and it should speak for itself:
Result: