Go the wp-job-manager plugin
Open wp-job-manager-functions.php file
I would suggest that you avoid doing this. Changes to core files will be removed whenever WP Job Manager updates.
The proper way to change the query args is via the filter here:
https://github.com/Automattic/WP-Job-Manager/blob/1.23.9/wp-job-manager-functions.php#L118
Simple example that reverses default values:
function modify_wpjm_query_args( $query_args ) {
if ( ! emtpy( $query_args['orderby'] ) ) {
$query_args['orderby'] = array(
'menu_order' => 'DESC',
'date' => 'ASC',
);
}
}
add_filter( 'job_manager_get_listings', 'modify_wpjm_query_args' );
Hey,
thanks for your answers! I finally found a workaround for my problem: I don’t need any filters! But thanks for posting the reference to the job-manager function, this is the file where I found the solution.
WP Job Manager stores each query in transients. That means a query will be cached (in this case for 30 days). If I change one of the job listings via save_post, the cache will be flushed and the next query will contain the actual menu_order values.
I didn’t find a solution how to prevent loading queries from the transients and my workaround is to flush the cache by saving one of the posts by hand.
JUST in case anyone jumps into here looking for the solution like I did, you need to add
return $query_args;
to the end of the function that Adam posted above. Thanks for posting this fix though!
Yikes! Good catch @cirkut. Thanks for sharing.