• Hi,

    i’m trying to extend the search. I search inside a second table (plugin needs this) and the results are post IDs. They should be included to the wp search.

    Example: I’ll search for “dog” – this word is not in any title/content, but inside the second table. The result will be ID 23.

    So how can i extend the search?

    This does not work (still searching for “dog” inside the wp_posts table… i need an “OR ID = 23” query ??

    function extend_search($query) {
        if ($query->is_search) {
            $query->set('post__in', array(23));
        }
        return $query;
    }
    add_filter('pre_get_posts','extend_search');
  • The topic ‘Include/extend post IDs to search’ is closed to new replies.