Quick Edit: Selected Custom Taxonomy Not Refreshing After Save

Added this code to updated the selected field by identifying the appropriate value in the taxonomy column:

jQuery(document).ready(function($) {

  // Create a copy of the WP inline edit post function
  var $wp_inline_edit = inlineEditPost.edit;

  // Overwrite the function with our own code
  inlineEditPost.edit = function( id ) {

     // Call the original WP edit function
     $wp_inline_edit.apply( this, arguments );

     // get the post ID
     var $post_id = 0;
     if ( typeof( id ) == 'object' )
        $post_id = parseInt( this.getId( id ) );

     if ( $post_id > 0 ) {

        // get the $outcome value from the relevant column
        var $outcome = $( '#outcome-' + $post_id ).text();

        // mark the current $outcome value as selected
        $("#tip_outcome_selection option").each(function(){
           if($( this ).val() == $outcome){
              $( this ).attr( "selected", "selected" );
           }
        });
     }
  };
});

Leave a Comment