See if this doesn’t do it:
First, the callback for that Ajax search (the wp_link_query
method in wp-includes/class-wp-editor.php
) suppresses the normal filters. We have to turn them back on for this particular query.
function undo_suppress($qry) {
global $_POST;
if (isset($_POST['action']) && 'wp-link-ajax' == $_POST['action']) {
$qry->set('suppress_filters',false);
}
}
add_action('pre_get_posts','undo_suppress');
Now we can use the posts_where
filter to enable searches across ‘future’ posts.
function search_future_editor_links($where) {
global $_POST;
if (isset($_POST['action']) && 'wp-link-ajax' == $_POST['action']) {
$where=" AND wp_posts.post_type IN ("post","page","attachment") AND wp_posts.post_status IN ("publish","future") ";
}
return $where;
}
add_filter('posts_where','search_future_editor_links');
You could add “drafts” to that last IN
if you wanted to search those too.