Question

This question is related to another previously asked question, which is a follow up on an answer.

Task

As I want to extend QuickEdit to be something really awesome (and more than just quick edit), I need the ID of the currently "quick edited" post in my callbacks.

Core MarkUp

From what I can see in core in the class-wp-posts/terms-list-table.php file and the WP_*_List_Table#inline_edit() function, there're no values for checkboxes, input fields, etc. set via PHP. All are set via JavaScript. The structure looks like that:

<!--
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>

Custom Quick Edit fields

Depending on what and on which list table (post/term) we want to add custom quick edit boxes to, we need to add callbacks to filters. Again, those only work if we got a custom column (see other question).

add_action( 'quick_edit_custom_box', array( $this, 'addFields' ), 10, 3 );
# add_action( 'bulk_edit_custom_box', array( $this, 'addFields' ), 10, 2 );

The callback itself has the actual problem I'm facing. We have two (or in case of terms, three) arguments: $postType and $columnName. Both doesn't help me to retrieve the actual $post_ID, which I'd need for stuff like the wp_editor() for example.

public function addFields( $colName, $postType, $taxonomy = '' )
{
    // How to retrieve the ID of the currently quick edited post in here?
}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top