do_action( 'quick_edit_custom_box', string $column_name , string $post_type , string $taxonomy )
Fires once for each column in Quick Edit mode.
Parameters
-
$column_name
string -
Name of the column to edit.
-
$post_type
string -
The post type slug, or current screen name if this is a taxonomy list table.
-
$taxonomy
string -
The taxonomy name, if any.
More Information
quick_edit_custom_box is an action that lets a plugin print inputs for custom columns when quick editing. This action is called one time for each custom column. Custom columns are added with the manage_{$post_type}_posts_columns filter. To save the data from the custom inputs, hook the save_post action.
Source
File: wp-admin/includes/class-wp-posts-list-table.php
.
View all references
do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' );
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example migrated from Codex:
Setting Existing Values
Populating inputs with existing values takes a bit of trickery. One can’t simply access the
$post
global because when this action is run, $post refers only to the last post (the quick edit inputs are created only once, and cloned as needed when quick editing a column). There are two parts: storing the data on the page and hookinginlineEditPost.edit
to set the input values. If the quick-edit columns are also displayed as custom columns, the data is already in the table. Otherwise, it can be added as hidden elements to an existing custom column.Hooking
inlineEditPost.edit
must be done in a JS script, loaded after js/_enqueues/admin/inline-edit-post.js. The original method is saved and replaced with a new one which calls the original. This particular technique is a simple example of aspect-oriented programming.PHP:
scripts/admin_edit.js:
Example migrated from Codex:
Creating Inputs
Example migrated from Codex:
Saving Data
Data entered in custom inputs can be saved by hooking the save_post action.