添加此代码以通过在“分类”列中标识适当的值来更新所选字段:
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" );
}
});
}
};
});