I looked into doing the same thing and in the end opted for a custom solution using thickbox as being less complex. Could be it’s possible, but perhaps not worth the effort. The code is certainly not built for customisation as far as I could see.
- Open a thickbox modal with a search field
- Ajax search the post title with the user-entered search term
- Echo the results into the modal as a list/table of post title, adding the post ID as a data attribute e.g. to a checkbox if the user can choose multiple items
- When the user clicks the ‘select’ button, use js to get the checked items and put them in a list/table in the page with the post id in a hidden field that you can access when the post is saved.
A couple of other notes:
- In my case searching the post title was sufficient, I used a custom query with
$wpdb -> prefix . 'posts.post_title LIKE %s
. explode()
and loop through each of the search terms, using each with'%' . $str . '%'
in the query