Include/extend post IDs to search (1 post)

  1. Ralac
    Posted 2 years ago #


    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;

Topic Closed

This topic has been closed to new replies.

About this Topic