add filter to “quick edit menu” in wordpress admin

i am currently working on a wordpress plugin. the plugin includes a database table that being update every time a post is being created, edited or deleted with the data of that post. one of the columns in this table is “post_status” and i need it to be updated with the status of a post whenever it changes. right now i am using this code:

function filter_transition_post_status( $new_status, $old_status, $post ) { 
    global $post;
    global $wpdb;
    $wpdb->query(" UPDATE my_table SET post_status='$new_status' WHERE post_id=$post->ID");
add_action('transition_post_status', 'filter_transition_post_status', 10, 3);

the code above work fine when i change the post status within the “edit post” page. when i change the status of a post the change happens in my table as well. however, the code doesn’t work when i use the “quick edit” mode to change the status of post or bulk change multiple posts. the change does not happen in my table. any help resolving this issue will be much appreciated. thank you

Solutions Collecting From Web of "add filter to “quick edit menu” in wordpress admin"

You do not want to reference the global $post, but the post that is given to you as one of the argument. You simply need to remove global $post;

Remember also to sanitize input and prefix function names.

function wpse50651_filter_transition_post_status( $new_status, $old_status, $post ) { 

    global $wpdb;

          "UPDATE my_table SET post_status=%s WHERE post_id=%d", 
add_action('transition_post_status', 'wpse50651_filter_transition_post_status', 10, 3);