hide expired jobs from joblist

Hi, I want to hide expired jobs. I tried the code from an other thread and copied it into my functions.php:

add_filter( ‘jbp_job_search_params’, ‘exclude_expires_job’ );

function exclude_expires_job( $args ) {

$jobs = JE_Job_Model::model()->all();

foreach ( $jobs as $job ) {

if($job->is_expired()){

$args[]=$job->id;

}

}

return $args;

}

This code does not work on my site.

How do I disable expired jobs automatically?

Thanks and kind regards