How do i append UNION SQL Query with default search query
Append data to the native search: You can try for example: add_action( ‘pre_get_posts’, function( $q ) { if( $q->is_main_query() && $q->is_search() ) { $q->set( ‘nopaging’, true ); add_filter( ‘posts_request’, function( $request ) { $sql=”YOUR EXTRA SQL QUERY”; return “({$request}) UNION ({$sql}) ORDER BY post_status DESC”; }); } }); where we use the no paging version … Read more