This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: page only specific search

#26150
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Sure! The Condos page ID is 7783 as I can see in the page editor. In this case, you need this custom code. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_filter( 'asp_query_args', 'asp_include_only_parent_ids', 10, 2 );
function asp_include_only_parent_ids( $args, $id ) {
  /**
   * Enter the post/cpt prent IDs here. The results will be
   * limited to objects with these parent IDs.   
   */     
  $ids = array(7783);
  /**
   * Search instance IDs you want this code to apply on.
   */
  $search_ids = array(1, 2);      
  
  // --------------------------------------------------
  // --------------------------------------------------
  // -- !! Do not change anything below this line !! --
  // --------------------------------------------------
  if ( in_array($id, $search_ids) )
    $args['post_parent'] = $ids;
  
  return $args;
}

Make sure to change the $search_ids variable according to which search IDs do you want to restrict to this condos search.