Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Diana K. Cury

    (@dianakc)

    Hello,

    If you say the default search form you can try adding the code in your functions.php:

    add_filter( 'pre_get_posts', 'dkc_remove_adopted' );
    
    function dkc_remove_adopted( $query ) {
    
    	$status = get_term_by('slug', 'adopted', 'pet-status'); //where adopted is the status
    
    	echo $status->term_id ;
    
    	if ( $query->is_search && !is_admin() )
    		$query->set( 'pet-status',$status->term_id );
    	return $query;
    }
    Plugin Author Diana K. Cury

    (@dianakc)

    Please remove the line echo $status->term_id ; it was a test hahah

    Thread Starter nrbailey

    (@nrbailey)

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Limit the pet search to Published pet posts?’ is closed to new replies.