Description
When using the [jobs] shortcode with a custom orderby parameter (e.g. orderby="title"), the sort order is ignored and listings default to date-descending order. This occurs when the "Featured Jobs" / featured_first option is active.
Steps to Reproduce
Enable "Featured Jobs" in WP Job Manager settings (or have at least one job marked as featured).
Place the [jobs orderby="title"] shortcode on a page.
View the page on the frontend.
Observe that job listings are ordered by date (newest first), not alphabetically by title.
Expected Behaviour
Job listings should be sorted alphabetically by title when orderby="title" is passed to the [jobs] shortcode, regardless of whether featured_first is active. Featured jobs should still appear first, but within the featured and non-featured groups, listings should respect the orderby parameter.
Actual Behaviour
The orderby parameter is silently overridden. Listings sort by date descending instead of by title. No error or warning is produced.
Root Cause (Hypothesis)
In wp-job-manager-functions.php (or class-wp-job-manager-shortcodes.php), when featured_first is truthy, the plugin wraps the user-supplied orderby value inside a compound orderby array to prioritise featured listings. This restructuring appears to stomp the original orderby value, causing it to be ignored by WP_Query.
Additional Context
Reported by a user on the WordPress.org support forum: https://wordpress.org/support/topic/changing-sort-to-sort-by-location/
The same user also reports that orderby="date" (the default) continues to work, suggesting the issue is specific to the featured_first + custom orderby interaction.
Description
When using the [jobs] shortcode with a custom orderby parameter (e.g. orderby="title"), the sort order is ignored and listings default to date-descending order. This occurs when the "Featured Jobs" / featured_first option is active.
Steps to Reproduce
Enable "Featured Jobs" in WP Job Manager settings (or have at least one job marked as featured).
Place the [jobs orderby="title"] shortcode on a page.
View the page on the frontend.
Observe that job listings are ordered by date (newest first), not alphabetically by title.
Expected Behaviour
Job listings should be sorted alphabetically by title when orderby="title" is passed to the [jobs] shortcode, regardless of whether featured_first is active. Featured jobs should still appear first, but within the featured and non-featured groups, listings should respect the orderby parameter.
Actual Behaviour
The orderby parameter is silently overridden. Listings sort by date descending instead of by title. No error or warning is produced.
Root Cause (Hypothesis)
In wp-job-manager-functions.php (or class-wp-job-manager-shortcodes.php), when featured_first is truthy, the plugin wraps the user-supplied orderby value inside a compound orderby array to prioritise featured listings. This restructuring appears to stomp the original orderby value, causing it to be ignored by WP_Query.
Additional Context
Reported by a user on the WordPress.org support forum: https://wordpress.org/support/topic/changing-sort-to-sort-by-location/
The same user also reports that orderby="date" (the default) continues to work, suggesting the issue is specific to the featured_first + custom orderby interaction.