Skip to content

Instantly share code, notes, and snippets.

@albionselimaj
Created February 19, 2018 18:31
Show Gist options
  • Save albionselimaj/bc926cbf4ff5f442c91fcc97845a72f6 to your computer and use it in GitHub Desktop.
Save albionselimaj/bc926cbf4ff5f442c91fcc97845a72f6 to your computer and use it in GitHub Desktop.
Display expired listings in search results
<?php
// Display Expired listings in search results
add_filter( 'get_job_listings_query_args', function( $args ) {
$args['post_status'] = [ 'publish', 'expired' ];
return $args;
}, 100 );
// Make Expired listings content public
add_action( 'init', function() {
global $wp_post_statuses;
if ( is_array( $wp_post_statuses ) && ! empty( $wp_post_statuses['expired'] ) ) {
$wp_post_statuses['expired']->public = true;
}
}, 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment