Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've used add_meta_box() to add a custom meta box to the WordPress edit window on both pages and posts.

How can I make this meta box also show on the "Quick Edit" screen?

Ideally, I'd like it to appear just to the right of the Categories selector.

share|improve this question

3 Answers

up vote 12 down vote accepted

There seems to be no easy way to do this, you must add all code yourself. inline_edit_row(), the function that draws the Quick Edit and Bulk Edit screens, seems to have only one action that you can hook into: quick_edit_custom_box or bulk_edit_custom_box. It gets called for all non-core columns that wp_manage_posts_columns() returns. There are some filters you can use to add a column, for example manage_posts_columns. Unfortunately, this function defines the column headers of the post table, so you should remove it again before print_column_headers() prints them. This can be done in the get_column_headers() function, with the manage_[screen_id]_headers filter. edit-post is the screen id for the Edit Posts screen.

All together, this gives a hack like the following to add some code. Finding out where you can handle the form submission is (currently) left as a exercise to the reader.

// Add a dummy column for the `posts` post type    
add_filter('manage_posts_columns', 'add_dummy_column', 10, 2);
function add_dummy_column($posts_columns, $post_type)
{
    $posts_columns['dummy'] = 'Dummy column';
    return $posts_columns;
}
// But remove it again on the edit screen (other screens to?)
add_filter('manage_edit-post_columns', 'remove_dummy_column');
function remove_dummy_column($posts_columns)
{
    unset($posts_columns['dummy']);
    return $posts_columns;
}

// Add our text to the quick edit box
add_action('quick_edit_custom_box', 'on_quick_edit_custom_box', 10, 2);
function on_quick_edit_custom_box($column_name, $post_type)
{
    if ('dummy' == $column_name) {
        echo 'Extra content in the quick edit box';
    }
}

// Add our text to the bulk edit box
add_action('bulk_edit_custom_box', 'on_bulk_edit_custom_box', 10, 2);
function on_bulk_edit_custom_box($column_name, $post_type)
{
    if ('dummy' == $column_name) {
        echo 'Extra content in the bulk edit box';
    }
}
share|improve this answer
Thanks Jan. I've just asked a somewhat similar question if you'd be kind enough to check it out:wordpress.stackexchange.com/questions/3531/… – Scott B Nov 1 '10 at 20:13
i just +1ed it. So don't wonder it got more than just half of the rep points of the Q. Nice comment from scott :) – kaiser Mar 30 '11 at 12:22
Very helpful, Jan. Follow-up question: how do you get access to the current post's data inside on_bulk_edit_custom_box in order to prepopulate fields? global $post doesn't seem to work. – Geert Oct 19 '11 at 7:28

I have also answered this with a more simple way to do it on this post here Quick edit screen customization

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.