Voxfor - All rights reserved - 2013-2025
We Accepted





Custom Quick Edit in WordPress is a convenient feature that lets you edit certain post fields directly from the admin listing (posts list table) without opening the full editor. It speeds up your workflow by allowing inline changes to titles, slugs, dates, categories, and more. However, by default, Quick Edit does not support custom fields or custom metadata โ it’s limited to basic fields provided by WordPressโ. It can be frustrating if you have a custom post type with custom fields (such as extra info, settings, or metadata) that you want to edit quickly.
The good news is that with a bit of coding, you can extend WordPress Quick Edit to handle custom fields for your custom post types. In this step-by-step tutorial, we’ll guide you through implementing custom inline editing for a custom post type’s custom fields on the admin listing screen. We’ll start from the basics (making this beginner-friendly) and then technical details (for advanced users) as needed. You’ll learn how to add custom Quick Edit fields, use AJAX in the WordPress admin to save those fields, and ensure everything is secure and functional.
By the end of this guide, you’ll be able to add “Quick Edit” support for your custom post type’s custom fields โ empowering you to update custom metadata inline, just like WordPress’s native fields. Let’s get started!
Quick Edit (and its sibling Bulk Edit) is a built-in WordPress feature for inline editing of posts, pages, and other content types from the list table view. It allows you to change details like the title, slug, date, author, status, tags, etc.. This feature saves time since you don’t have to load the full post editor for small changes. For example, to change the author or update the status of a post, you can simply click “Quick Edit” under the post title and modify those fields instantly.
However, Quick Edit has limitations. It doesn’t include custom fields by defaultโ. In other words, if you’ve added custom meta fields to your posts or have a custom post type with additional metadata, those fields won’t appear in Quick Edit automatically. As a result, you “can’t adjust … anything beyond basic data from the list table” using Quick Editโโ you’d normally have to open each post individually to edit custom fields. It is where extending Quick Edit becomes useful. By adding your custom fields to the Quick Edit interface, you can manage them inline, making content management more efficient.
Why implement custom Quick Edit for custom fields? Here are a few benefits:
In the following sections, we’ll walk through how to implement a custom Quick Edit for a custom post type fields. We’ll use a practical example and break it down into clear steps.
The first step in enabling Quick Edit for a custom field is to add that field as a column in the post list table (the admin screen listing your posts of that type). WordPress’ Quick Edit system is built around the columns in the list table โ in fact, the hook to output Quick Edit fields runs only if you have a custom column presentโ. This means if you want a custom Quick Edit field, you should have a corresponding custom column in the list view (even if you don’t necessarily show a value).
Why add a column? Aside from the technical requirement, having a visible column showing the current value of your custom field is helpful. It lets admins see and confirm the value right in the list, and it provides a place from which we can pull the data to populate the Quick Edit form (since Quick Edit will read values from the table row).
Let’s say we have a custom post type called “Book” (slug: book). This post type has two custom meta fields we want to manage via Quick Edit: “Author Name” (text) and “In Print” (a boolean checkbox indicating if the book is in print). We will add two columns for these fields in the Books list table.To add custom columns, we use WordPress hooks: a filter to add the column headers, and an action to output the column content. In code, it looks like this:
// PHP Code
// 1. Register custom columns for the "book" post type:
add_filter('manage_book_posts_columns', 'my_book_add_columns');
function my_book_add_columns($columns) {
// Add new columns for Author and In Print
$columns['book_author'] = 'Author Name';
$columns['inprint'] = 'In Print';
return $columns;
}
// 2. Output content for custom columns:
add_action('manage_book_posts_custom_column', 'my_book_custom_column_content', 10, 2);
function my_book_custom_column_content($column_name, $post_id) {
switch ($column_name) {
case 'book_author':
// Display the author name meta value
$author = get_post_meta($post_id, 'book_author', true);
echo esc_html($author);
break;
case 'inprint':
// Display a checkbox (checked if true) for the In Print status
$in_print = get_post_meta($post_id, 'inprint', true);
if ($in_print) {
// Output a checked checkbox (read-only for display)
echo "<input type='checkbox' disabled checked />";
} else {
echo "<input type='checkbox' disabled />";
}
break;
}
}
In the code above:
Deep Dive: Why use a disabled checkbox for the boolean field? We could simply show “Yes/No” or a tick mark, but outputting an actual (disabled) checkbox in the list column is a neat trick. It allows our JavaScript to easily grab the checked property when filling the Quick Edit form. The WordPress Developer Resources notes that when setting up Quick Edit for custom fields, “if the quick-edit columns are also displayed as custom columns, the data is already in the table”โ, making it straightforward to retrieve. We’ll see how this works in the JavaScript step.
Also note, we did not include any HTML for the Author Name (just text), but we included a checkbox input for In Print. This is optional โ you could also output text (“Yes”/”No”) for the boolean and parse that in JS. Using an actual input is convenient for boolean fields. For text fields, just outputting the text is fine.
Finally, adding these columns not only prepares for Quick Edit but also makes the post list more informative. At this point, if you reload the Books list in WP Admin, you should see the new “Author Name” and “In Print” columns with their values (if any) displayed.Important: If you don’t see your new columns, double-check that the code is running (e.g., placed in a plugin or your theme’s functions.php). Also ensure you flush permalinks or re-save your CPT registration if needed (though columns don’t usually require that). Remember, the manage_book_posts_columns filter will only apply on the Books list screen.
Now that our custom columns are in place, we can add the corresponding input fields to the Quick Edit interface for those columns. WordPress provides an action hook called quick_edit_custom_box for this purpose. This hook allows us to output additional form fields inside the Quick Edit form (the little inline edit area that appears when you click Quick Edit).
We will use add_action(‘quick_edit_custom_box‘, …) to inject our custom fields. This action passes the column name and post type as parameters, which we can use to ensure we only output our fields for the relevant column and post type.
Let’s write the code to add our “Author Name” text input and “In Print” checkbox to the Quick Edit form for books:
// PHP Code
// 3. Output custom Quick Edit fields for the Book post type:
add_action('quick_edit_custom_box', 'my_book_quick_edit_fields', 10, 2);
function my_book_quick_edit_fields($column_name, $post_type) {
if ($post_type !== 'book') return; // Only add to Book post type Quick Edit
switch ($column_name) {
case 'book_author': ?>
<!-- Quick Edit field for Author Name -->
<fieldset class="inline-edit-col-right">
<div class="inline-edit-col">
<label class="inline-edit-group">
<span class="title">Author Name</span>
<span class="input-text-wrap">
<input type="text" name="book_author" class="ptitle" value="">
</span>
</label>
</div>
</fieldset>
<?php
break;
case 'inprint': ?>
<!-- Quick Edit field for In Print (checkbox) -->
<fieldset class="inline-edit-col-right">
<div class="inline-edit-col">
<label class="inline-edit-group">
<span class="title">In Print</span>
<input type="checkbox" name="inprint" value="1">
</label>
</div>
</fieldset>
<?php
break;
}
}
What this does:
These fields will appear in the Quick Edit form when you click Quick Edit on a Book item. But you might wonder: how do these fields get populated with the current values? Right now, we’ve output static fields with no values. If you Quick Edit a post at this stage, you’d see the fields but they’d be blank (or the checkbox unchecked by default). We need a way to populate those inputs with the existing meta values of the specific post you’re editing.
WordPress doesn’t automatically fill in custom Quick Edit fields; we have to do it via JavaScript. We’ll tackle that in Step 4. But before that, let’s address loading the script itself.
Deep Dive: Notice we placed the quick edit fields inside <fieldset class=”inline-edit-col-right”>. WordPress’ Quick Edit form has a left and right column layout. The default fields like Title, Slug, Date, etc., occupy the left side or right side depending on core code. For simplicity, we put ours all in the right column. This is mostly cosmetic (ensuring things align nicely). You could also use inline-edit-col-left if needed. The class names we used (like ptitle on the input) mimic WordPress styling but aren’t strictly required. The key is that the name attributes are set, because they determine what gets saved.
Also, we did not output a nonce field here. It’s often a good idea to include a nonce for security. We could call wp_nonce_field() once to output a nonce that we’ll check when saving (more on that in Step 5). One nuance: quick_edit_custom_box fires for each column, but we only need one nonce total. A common pattern is to use a static $printed_nonce flag so you print the nonce only onceโ. For clarity, we omitted the nonce in the snippet above, but we’ll show nonce usage in the save step.
At this point, after Step 2, your Quick Edit form will have the new fields. But they won’t show the current values yet โ we handle that next.
We need to write JavaScript to populate our custom Quick Edit fields with the current post’s values (and later, maybe handle some AJAX nuances). WordPress loads a core script called inline-edit-post.js, which controls the Quick Edit behavior. Our goal is to extend or override a part of that script so that when a user clicks “Quick Edit” on a post, our custom fields get filled in.
There are a couple of ways to inject our JavaScript:
Using wp_enqueue_script is cleaner and is the recommended approach. We can enqueue a script that depends on jQuery and the inline edit script. Usually, inline-edit-post.js is enqueued by WordPress on edit listing pages. We’ll attach our script after it.
Let’s enqueue a JS file called admin-book-quick-edit.js (you can name it as you like) when on the Books list screen:
// PHP CODE
// Enqueue custom Quick Edit script on the Books admin listing page
add_action('admin_enqueue_scripts', 'my_book_quick_edit_script');
function my_book_quick_edit_script($hook) {
// Only load on the book list page (edit.php for post_type=book)
if ($hook === 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] === 'book') {
// Register or directly enqueue the script
wp_enqueue_script(
'book-quick-edit',
plugin_dir_url(__FILE__) . 'admin-book-quick-edit.js', // adjust path if needed
array('jquery', 'inline-edit-post'),
false,
true // load in footer
);
}
}
In this snippet:
Now WordPress will load our script on the Books admin list. But what should this script do?
The main task of our JavaScript is to hook into the Quick Edit action and fill our form inputs with the existing values of the post’s custom fields. WordPress’ inline-edit-post.js provides a global object inlineEditPost with a method edit(). This edit() method is called when the user clicks a Quick Edit link. Our strategy will be to override this method or extend it so that after WordPress sets up the Quick Edit form, we insert our custom logic to populate the fields.
A common approach (and recommended by WordPress docs) is to save the original edit() method, then assign a new function that calls the original and adds our behaviorโ. This way, we don’t lose any default functionality โ we just augment it.
Below is a sample content for admin-book-quick-edit.js:
// JS SCRIPT
(function($) {
// Save a reference to the original Quick Edit function
var $wp_inline_edit = inlineEditPost.edit;
// Overwrite the inlineEditPost.edit function with our own
inlineEditPost.edit = function(post_id) {
// Call the original edit function first
$wp_inline_edit.apply(this, arguments);
// Now, add our custom field population
// Get the post ID being edited
var id = 0;
if (typeof post_id === 'object') {
id = this.getId(post_id); // if post_id is an event, extract the actual ID
} else {
id = post_id;
}
if (!id) return; // safety check
// Define the specific rows
var $editRow = $('#edit-' + id); // Quick Edit form row
var $postRow = $('#post-' + id); // the post's row in the table
// Get the data from the existing columns
var authorName = $('.column-book_author', $postRow).text().trim();
var inPrintChecked = $('.column-inprint input[type="checkbox"]', $postRow).prop('checked');
// Populate the Quick Edit fields with this data
$(':input[name="book_author"]', $editRow).val(authorName);
$(':input[name="inprint"]', $editRow).prop('checked', inPrintChecked);
};
})(jQuery);
At this point, if you go to the Books list and click Quick Edit on a post, the Quick Edit form will slide open and you should see the Author Name field pre-filled with the post’s author name, and the In Print checkbox checked or unchecked reflecting the current status.
Behind the scenes, what we did is essentially hook into the Quick Edit process. The official WordPress handbook describes this technique and notes that it’s an example of simple aspect-oriented programming, where we wrap the original function with our own to inject behaviorโ. We made use of the fact that our custom column data is already in the table (either as text or as a checkbox input), so we didn’t need an extra AJAX call to fetch the data โ we just pulled it from the DOM. This is efficient and keeps things simple.
Deep Dive (AJAX and Quick Edit Saving): You might wonder, when you click “Update” in Quick Edit, how does WordPress save the data? Quick Edit uses an AJAX request behind the scenes to save changes without reloading the page. When you hit Update, the form fields (including our custom ones) are sent via AJAX to the server, which processes the save and returns updated values. WordPress core listens for this AJAX response and updates the table row. Our implementation ties into this seamlessly. We just need to ensure the server knows how to save our custom fields. By adding our input fields with proper name attributes, and by writing a server-side save handler (next step), the AJAX save will include our fields and update our columns accordingly. (We don’t have to write any custom AJAX JavaScript; WordPress handles the submission. We just hooked into the preparation and will hook into saving via PHP.)
One more thing: We could have alternatively attached our custom field population by binding to the Quick Edit link click event (for example, using a jQuery click handler on .editinline links). In fact, another approach (as shown by some developers) is to add an onclick attribute to the Quick Edit link via a filterโ. That method calls a JS function to set field values. While that works, the approach we used (overriding inlineEditPost.edit) is a bit cleaner and is the method suggested in WordPress’ documentationโ. It ensures our code runs every time Quick Edit is invoked and after the default behavior, without manually altering each link.
Now we’ve got the client-side (browser) part done: fields appear and get populated in Quick Edit. The final piece is saving the data to the database when the user clicks Update.
When a Quick Edit form is submitted (the user clicks Update), WordPress will call the regular post update mechanism internally (specifically, it triggers an inline-save AJAX action, which ultimately ends up calling wp_update_post and related hooks). Therefore, our custom fields can be saved by hooking into the normal post saving process โ specifically the save_post action.
The save_post action runs whenever a post is created or updated (including Quick Edit updates). We can intercept that and update our custom fields accordingly. It’s very similar to how one would save custom fields from a meta box on the post edit screen.
Let’s add a function to handle saving our two fields:
// PHP CODE
// Save custom Quick Edit fields data
add_action('save_post', 'my_book_save_quick_edit_data');
function my_book_save_quick_edit_data($post_id) {
// Security and sanity checks:
// a) Check post type to ensure it's our CPT
if (get_post_type($post_id) !== 'book') {
return;
}
// b) Check user capabilities
if (!current_user_can('edit_post', $post_id)) {
return;
}
// c) If this is an autosave or revision, abort (we only want actual form submissions)
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (wp_is_post_revision($post_id)) {
return;
}
// d) Verify nonce (if we had set one in Quick Edit form)
if (isset($_POST['book_edit_nonce']) && !wp_verify_nonce($_POST['book_edit_nonce'], plugin_basename(__FILE__))) {
return;
}
// Now, save the custom fields if present in $_POST
if (isset($_POST['book_author'])) {
$author_name = sanitize_text_field($_POST['book_author']);
update_post_meta($post_id, 'book_author', $author_name);
}
// For checkbox: if 'inprint' is in POST, it was checked; if not, it was unchecked.
if (isset($_POST['inprint'])) {
update_post_meta($post_id, 'inprint', 1);
} else {
// If checkbox not present, user unchecked it
update_post_meta($post_id, 'inprint', 0);
}
}
Explanation of the save function:
Since Quick Edit uses AJAX, when our save_post hook runs, WordPress will handle returning a response to the browser. If everything is successful, the page will update the row with new values. Our custom column output function (from Step 1) will populate the new values in the table. All of this happens without a full page reload.
Test it out: After implementing the above code, go to your Books list table in WP Admin. Try editing the Author Name or toggling the In Print checkbox via Quick Edit, then click Update. The row should update to reflect your changes. You can verify in the database or by reloading the page that the custom fields changed. If something doesn’t work, check the browser console (for any JS errors), and check your PHP error log (for any mistakes in hook names or logic).
Important: The quick_edit_custom_box action (from Step 2) only fires if a custom column existsโ, which we handled in Step 1. Also, ensure that the names of input fields in the Quick Edit form match what you look for in $_POST when saving. In our case they do (book_author and inprint). A common bug is a mismatch in these names, leading to $_POST missing your fields.
To give you a better understanding (especially for advanced developers curious about the internals), here’s a summary of what’s happening behind the scenes when using Quick Edit with custom fields:
Throughout this flow, our added code works within the WordPress system: using provided hooks and script extensibility. This means our solution should continue to work as WordPress updates, as long as those hooks remain (they have been around since WordPress 2.7 for Quick Editโ).
Now that we’ve covered the implementation, let’s address some common questions you might have:
Implementing custom inline editing (Quick Edit) for a custom post type’s fields in WordPress involves a combination of PHP and JavaScript, but it’s quite achievable with the steps we’ve outlined. We started by adding custom columns to the admin list to display the custom field values (ensuring the Quick Edit hook would fireโ and giving us a place to pull data from). Then we injected our inputs into the Quick Edit form via quick_edit_custom_box. After that, we enqueued a script and wrote JavaScript to populate those inputs with the existing values when Quick Edit is opened. Finally, we handled saving the data on the server side with a save_post hook, updating our post meta accordingly. Throughout the process, we used WordPress’ hooks and followed its structure, resulting in a seamless integration โ to the user, it feels like WordPress just natively supports those extra fields in Quick Edit.
By following this guide, you’ve effectively extended WordPress’s Quick Edit functionality to suit your custom needs. This can greatly improve your content management efficiency when dealing with custom post types. No longer are you limited to basic fields in the list table โ you can tailor the inline editing experience to your data.
Hassan Tahir wrote this article, drawing on his experience to clarify WordPress concepts and enhance developer understanding. Through his work, he aims to help both beginners and professionals refine their skills and tackle WordPress projects with greater confidence.
Oliver Bennett
This guide offers an exceptionally thorough and well-structured approach to extending WordPress Quick Edit functionality. The seamless blend of PHP and JavaScript makes it both practical and insightful.
Oliver Grant
Fantastic guide! You’ve made it super easy to extend WordPress Quick Edit for custom fields, which will save so much time when managing custom post types. This is going to streamline my workflow significantly!
Ethan Reynolds
A brilliant and in-depth walkthrough! This guide makes extending WordPress Quick Edit for custom fields approachable, even for developers new to the admin side.