How to Set Specific Category in Search Bar on a Specific Page in WordPress?
add_filter( 'geodir_search_output_to_main_categories', 'wpsc_my_set_cat_search', 8, 3 );
function wpsc_my_set_cat_search( $html, $cf, $post_type ){
global $post;
if( is_page() && isset($post->ID) ){ // use is_page() for pages and is_single() for blog posts
if( $post->ID == 1469 ){// page ID
$_REQUEST['spost_category'][] = 3; // category ID
}elseif( $post->ID == 1234 ){ // page ID
$_REQUEST['spost_category'][] = 9; // category ID
}
}
return $html;
}