feat(admin): add Job Data fields to Bulk Edit - #3045
Open
faisalahammad wants to merge 2 commits into
Open
Conversation
Add Job Data fields (Location, Company Name, Expiry, etc.) to the Bulk Edit form so administrators can edit multiple listings at once. Fixes Automattic#2448
Contributor
This is solid work — nonce, per-post Needs fixing
Adjacent to #3040 (Quick Edit): no conflict, but the two build parallel auth/sanitization paths |
bulk_edit_save hooks save_post at priority 10 and calls wp_update_post when the listing's expiry puts it in the past. wp_update_post fires save_post synchronously, so every save_post listener (this one included) would re-run for the post. Wrap the wp_update_post call in remove_action/add_action to mirror the existing guard in save_job_listing_data(). Also switch the new bulk_edit_excluded_field_types @SInCE token to $$next-version$$ and exclude textarea + wp_editor from the default bulk-edit field set (single-line text input is not appropriate for them). Addresses PR feedback. Refs Automattic#3045
Author
|
Fixed in a01511c. Items 1, 2, 3 all addressed.
PHPCS clean on the edited file locally. PR description filled with Release Notes + Hooks section per template. Ready for re-review when you have a moment. |
faisalahammad
added a commit
to faisalahammad/WP-Job-Manager
that referenced
this pull request
Jul 29, 2026
Address review feedback on Automattic#3040: - Gate the Quick Edit row action off for expired, pending_payment, and preview listings. Core's inline-edit Status select only offers core statuses, so a save on a WPJM-managed status would silently fall back to publish and republish the listing. - Add autosave/revision guards to quick_edit_save (post-type, DOING_AUTOSAVE, wp_is_post_revision/wp_is_post_autosave) for parity with the existing save_post handler and Automattic#3045's bulk_edit_save. - Switch the capability check from the flat CAP_MANAGE_LISTINGS (which ignored $post_id) to a per-post current_user_can('edit_post', $post_id), matching the established save_post convention. - Add @SInCE $$next-version$$ to quick_edit_custom_box, add_inline_data, and quick_edit_save. - Add tests for the WPJM-managed status gate, non-admin denial, and the revision short-circuit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds support for bulk editing Job Data fields on the job listings list table. Administrators can now update common fields (such as Location, Company Name, Expiry date, and Filled status) for multiple listings at once, where empty fields are treated as "no change."
Closes #2448
Changes
WP_Job_Manager_Writepanels
Before:
After:
Why:
We need to register hooks for native WordPress bulk edit rendering (
bulk_edit_custom_box) and saving (save_post). We implementedget_bulk_edit_fields(),bulk_edit_fields(), andbulk_edit_save()to handle rendering and processing the bulk metadata fields securely with nonce validation and proper capability checks.Testing
Test 1: Bulk Edit text fields and selects
Result: works as expected
Test 2: Clearing Expiry Date
Result: works as expected
Test 3: Expiry Date Past status flip
Result: works as expected
Test 4: Capability and security checks
manage_job_listingscapability.Result: works as expected
Automated PHPUnit tests were also added in
tests/php/tests/includes/admin/test_class.wp-job-manager-writepanels.phpand they all pass cleanly.Screenshots
Release Notes
New or Updated Hooks and Templates
job_manager_bulk_edit_excluded_field_types(array of field type strings excluded from bulk edit; defaults tofile,info,hidden,author,textarea,wp_editor). Receives$excludedarray.Deprecated Code