Restrict search results to specific pages using array variable? (1 post)

  1. yarnboy
    Posted 3 years ago #


    I'm restricting my search function using a filter similar to this:

    function searchfilter($query) {
    	    if ($query->is_search) {
    	return $query;

    What I'm trying to do is limit the search to certain pages. I have the IDs of these pages stored in a global variable from a different function ($page_array), so I know I shouldn't have to list all of the page IDs in another array, like this:

    $query->set('ID', array(52, 33, 45, etc));

    But I can't figure out how to pass the $page_array variable to the filter function. I'm feeling syntactically challenged. Any assistance is greatly appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.