我上一个项目中的一个小例子。重要的部分是挂钩quick_edit_custom_box. 在这个钩子上可以添加表单元素。第二个重要部分是添加通过javascript更新数据的脚本。本例中的脚本是在edit中添加到头部的。php;页脚更好,你必须检查正确的页面。
下面的示例源代码位于一个类中,请注意这一点。
add_action( \'quick_edit_custom_box\', array( $this, \'add_quick_edit\' ), 10, 2 );
add_action( \'admin_head-edit.php\',   array( $this, \'quick_add_script\' ) );
/**
 * Add data to quick edit on list post and page
 * 
 * @since   0.0.1
 * @access  public
 * @uses    wp_nonce_field, plugin_basename, get_plw123mh_hosts, esc_url_raw, _e
 * @param   string array $column_name
 * @param   string $post_type
 * @return  string
 */
public function add_quick_edit ( $column_name, $post_type ) {
    if ( \'multihosts\' != $column_name )
        return;
    // Use nonce for verification
    wp_nonce_field( plugin_basename( __FILE__ ), self :: get_textdomain() . \'_nonce\' );
    $hostlist = $this -> get_plw123mh_hosts();
    $checkboxes = \'\';
    while( list($key, $val) = each($hostlist) ) {
        if( \'\' != $val ) {
            $val_e  = esc_url_raw($val);
            $val    = \'_\' . str_replace( \'.\', \'_\', trim( strtolower($val_e) ) );
            /*
            $data   = get_post_meta( $post->ID, $val , TRUE );
            if ( 1 == $data || \'\' === $data )
                $checked = \' checked="checked"\';
            else 
            */
                $checked = \'\';
            $checkboxes .= \'<label class="alignleft"><input type="checkbox" id="\' 
            . $val . \'_check" name="\' . $val 
            . \'" value="1"\' . $checked . \'/><span class="checkbox-title"> \' . $val_e . \'</span></label>\' . "\\n";
        }
    }
    ?>
    <fieldset class="inline-edit-col-left">
        <div class="inline-edit-col">
            <span class="title"><?php _e( \'Multihosts\', self :: get_textdomain() ); ?></span>
            <div class="inline-edit-group">
    <?php
    echo $checkboxes;
    ?>
            </div>
        </div>
    </fieldset>
    <?php
}
    public function quick_add_script () {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function($) {
        $(\'a.editinline\').live(\'click\', function() {
            var id = inlineEditPost.getId(this);
            var val = parseInt( $(\'#inline_\' + id + \'_http://localhost\').text() );
            $(\'#_http://localhost_check\').attr(\'checked\', !!val);
        });
    });
    </script>
    <?php
}
 另请参见
this answer WPSE 7291 例如。还有更多提示,包括
this answer WPSE 3316.
最后提示:您还可以通过hook“edit\\u post”保存数据。还有一个小例子,从头开始写。
add_action( \'edit_post\', array( $this, \'quick_edit_save\' ), 10, 3 );
function ilc_quickedit_save($post_id, $post) {
    if ( $post->post_type !== \'event\' )
        return;
    if ( isset( $_POST[\'is_quickedit\'] ) )
        update_post_meta( $post_id, \'eventdate\', esc_attr( $_POST[\'eventdate\'] ) );
}