The search worked after I unchecked Expired Positions under Settings – Jobs. Expired positions are now searchable in the admin panel.
Unfortunately, the expired jobs also appeared in the frontend, so I added code to the functions.php of the theme to make them not show up in the frontend search:
- /**Hide expired positions in frontend search
*/
function hide_expired_positions_in_frontend_search( $args ) {
// Check if the current query is a frontend search query
if ( ! is_admin() && $args[‘post_type’] === ‘job_listing’ ) {
// Modify the query to exclude expired positions
$args[‘meta_query’][] = array(
‘key’ => ‘_job_expires’,
‘value’ => current_time( ‘mysql’ ),
‘compare’ => ‘>’,
‘type’ => ‘DATETIME’,
);
} return $args;
}
add_filter( ‘job_manager_get_listings’, ‘hide_expired_positions_in_frontend_search’ );
Please developers – fix this bug in the next update of WP Job Manager!