WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I refresh the wp-admin/edit.php page after a user clicks Update in the Quick-edit form?

share|improve this question
Just add a js click handler to the link/button from within a custom plugin. – kaiser Sep 14 '12 at 18:53
It has to occur after the ajax call, otherwise the update will have no affect. – getWeberForStackExchange Sep 14 '12 at 22:37
Then add your event handler after the ajax call happened. – kaiser Sep 15 '12 at 1:27

We have to intercept the Ajax end point of that action. The file wp-admin/admin-ajax.php has all the possible hooks in the $core_actions_post array.

The function wpse_65157_ajax_inline_save() is a copy of the Core's, with a "force reload" script printed at the end. It has to be with Javascript, as wp_redirect() doesn't work.

add_action( 'wp_ajax_inline-save', 'wpse_65157_ajax_inline_save' , 0 );

 Copy of the function wp_ajax_inline_save()

 Only Modification marked at the end of the function with INTERCEPT
function wpse_65157_ajax_inline_save()
    global $wp_list_table;

    check_ajax_referer( 'inlineeditnonce', '_inline_edit' );

    if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )

    if ( 'page' == $_POST['post_type'] ) {
        if ( ! current_user_can( 'edit_page', $post_ID ) )
            wp_die( __( 'You are not allowed to edit this page.' ) );
    } else {
        if ( ! current_user_can( 'edit_post', $post_ID ) )
            wp_die( __( 'You are not allowed to edit this post.' ) );

    set_current_screen( $_POST['screen'] );

    if ( $last = wp_check_post_lock( $post_ID ) ) {
        $last_user = get_userdata( $last );
        $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
        printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ),    esc_html( $last_user_name ) );

    $data = &$_POST;

    $post = get_post( $post_ID, ARRAY_A );
    $post = add_magic_quotes($post); //since it is from db

    $data['content'] = $post['post_content'];
    $data['excerpt'] = $post['post_excerpt'];

    // rename
    $data['user_ID'] = $GLOBALS['user_ID'];

    if ( isset($data['post_parent']) )
        $data['parent_id'] = $data['post_parent'];

    // status
    if ( isset($data['keep_private']) && 'private' == $data['keep_private'] )
        $data['post_status'] = 'private';
        $data['post_status'] = $data['_status'];

    if ( empty($data['comment_status']) )
        $data['comment_status'] = 'closed';
    if ( empty($data['ping_status']) )
        $data['ping_status'] = 'closed';

    // update the post

    $wp_list_table = _get_list_table('WP_Posts_List_Table');

    $mode = $_POST['post_view'];
    $wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ) );

    // INTERCEPT: Check if it is our post_type, if not, do nothing  
    if( 'post' == $_POST['post_type'] )
        <script type="text/javascript">
    // end INTERCEPT



Reference Q&A: How to enable comments for pending and draft posts?

share|improve this answer
up vote 0 down vote accepted

I dug through WordPress' wp-admin/js/inline-edit-post-dev.js and found that there aren't any hooks for executing JS code after the quick-edit update.

I decided to override the inlineEditPost.save function from wp-admin/js/inline-edit-post-dev.js, similar to how WordPress recommends updating form data when the quick edit form is displayed (which overrides inlineEditPost.edit).

The full function can be found in wp-admin/js/inline-edit-post-dev.js. I just changed the callback function in the post call to reload the page instead of hiding the quick edit form.

(function($) {
    inlineEditPost.save = function(id) {
        // make ajax request
        $.post( ajaxurl, params,
            function(r) {
        , 'html');
share|improve this answer
If anybody has a better suggestion, please post! – getWeberForStackExchange Sep 14 '12 at 18:40
Downvotes without explanations are lame. – getWeberForStackExchange Sep 14 '12 at 22:37
Much probably the first downvote was for the same reason: modifying the core is not considered a good answer... – brasofilo Dec 1 '12 at 17:29
I used the word overwrite in my answer instead of override, which seems to have caused confusion. I never modified core code directly, I just overrode a core function in my own JS file. WordPress recommends doing this all over the place in PHP, so I can't see how this is any worse in JavaScript. For example from the link in my answer above (codex.wordpress.org/Plugin_API/Action_Reference/…), WordPress actually recommends overriding another function of theirs from a script (plugins_url('scripts/admin_edit.js', __FILE__)). Oh well. – getWeberForStackExchange Jan 16 '13 at 22:17

Your Answer


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.