这个问题是相关的to another previously asked question, 这是一个后续的答案。
任务
由于我想将QuickEdit扩展为真正棒的东西(不仅仅是QuickEdit),我需要回调中当前“快速编辑”帖子的ID。
核心标记class-wp-posts/terms-list-table.php
文件和WP_*_List_Table#inline_edit()
函数中,没有通过PHP设置的复选框、输入字段等的值。所有这些都是通过JavaScript设置的。结构如下所示:
<!--
The post list & the inline edit markup row that gets moved
based on what post we currently edit
-->
<form id="posts-filter" action method="get">
<table class="wp-list-table ...">
<tbody id="the-list">
<tr id="post-{$ID}">Post Data</tr>
<tr id="post-{$ID}">another post... etc.</tr>
<!-- ... even more posts -->
</tbody>
</table>
<!--
Here goes the edit row.
It\'s filled, edited and moved dynmically.
-->
<tr id="edit-{$currently_edited_post_ID}">
<!-- ... -->
</tr>
</form>
<form method="get" action>
<table style="display:none;">
<tbody id="inlineedit">
<tr id="inline-edit">
<!--
Here are the default quick edit boxes
as well as all custom boxes.
You\'ll have to add a custom columns as well - see other question.
-->
</tr>
<tr id="bulk-edit"></tr>
</tbody>
</table>
</form>
自定义快速编辑字段取决于要向其中添加自定义快速编辑框的列表表(post/term),我们需要向过滤器添加回调。同样,只有当我们有一个自定义列时,这些才起作用(参见其他问题)。
add_action( \'quick_edit_custom_box\', array( $this, \'addFields\' ), 10, 3 );
# add_action( \'bulk_edit_custom_box\', array( $this, \'addFields\' ), 10, 2 );
回调本身具有实际
problem I\'m facing. 我们有两个(如果是术语,则有三个)论点:
$postType
和
$columnName
. 两者都不能帮助我检索实际
$post_ID
, 我需要这样的东西
wp_editor()
例如
public function addFields( $colName, $postType, $taxonomy = \'\' )
{
// How to retrieve the ID of the currently quick edited post in here?
}