Make WordPress Core

Opened 5 years ago

Last modified 4 days ago

#53195 new defect (bug)

Add $post or $post_id to the quick_edit_custom_box hook

Reported by: tomdevisser Owned by:
Priority: normal Milestone: Awaiting Review
Component: Quick/Bulk Edit Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: administration

Description

Right now when you're adding a custom box to quick edit, you can't set an existing value without using JavaScript, cause you don't have acces to the post. For a more elaborate explanation, see the User Contributed Notes, top one by stevenlinx: https://developer.wordpress.org/reference/hooks/quick_edit_custom_box/

It would be more elegant if we could just use the post within the hook I think.

Change History (2)

#1 @SirLouen
12 months ago

  • Component Posts, Post TypesQuick/Bulk Edit

This ticket was mentioned in PR #13489 on WordPress/wordpress-develop by @arkaprabhachowdhury.


4 days ago
#2

  • Keywords has-patch has-unit-tests added; needs-patch removed

This fixes #53195 by passing the WP_Post object used to populate the Quick Edit form as the fourth argument to the quick_edit_custom_box action for post list tables.

This gives callbacks access to the post context when rendering custom Quick Edit fields.

## Testing

  • Focused PHPUnit test: 1 test, 2 assertions passed using the Local by Flywheel wordpress-develop PHP/MySQL runtime.
  • PHPCS passed with 0 errors and 2 existing warnings in the unchanged baseline code at class-wp-posts-list-table.php lines 97 and 123.
  • PHPCBF completed with no fixable errors.
  • php -l passed for both changed PHP files.
  • git diff --check passed.

Trac ticket: https://core.trac.wordpress.org/ticket/53195

## Use of AI Tools

AI assistance: Yes
Tool(s): ChatGPT/Codex
Model(s): GPT-5
Used for: Implementation, test coverage, and validation; the final patch and test results were reviewed before submission.

Note: See TracTickets for help on using tickets.