Viewing 11 replies - 1 through 11 (of 11 total)
  • Oshouki

    (@oshouki)

    I’ve confirmed that this is happening in the plugin.

    The problem stems from the fact that the action hooks used to add the select box to Quick Edit and Bulk Edit are called once for each custom column in the admin Posts view.

    normadize, I suspect you have plugins or a theme that have introduced custom columns and therefore you are seeing multiple select dropdowns.

    I recommend the plugin author to consider add the following edit to the quickedit() function to correct the issue:

    public function quickedit( $column_name, $post_type ) {
      if ( 'post_type' !== $column_name )
        return;
      ... the rest of existing code ...
    }
    Thread Starter normadize

    (@normadize)

    EDIT: At first I though Oshouki is the plugin author (asking me to write to the author of another plugin to fix a code conflict).

    Thanks for the fix!

    However, I do not have any custom/extra columns in the posts or postmeta tables in the database. The column post_type is a native column. I have only registered custom post types.

    Oshouki

    (@oshouki)

    normadize, no problem. I can see how it could have been misinterpreted now that I reread my comment. I’m glad my fix worked for you.

    What I meant by custom columns is this:

    This action is called one time for each custom column. Custom columns are added with the manage_edit-${post_type}_columns filter.

    as quoted from WordPress Plugin API documentation: quick_edit_custom_box action hook

    The solution is not to check the post type — this plugin should be available on all post types — but whether the quick_edit_custom_box hook has already run.

    Add this to the quickedit() function, above the markup, fixes the problem.

    if ( did_action( 'quick_edit_custom_box' ) !== 1 ) return;
    Thread Starter normadize

    (@normadize)

    The solution is not to check the post type — this plugin should be available on all post types

    But Oshouki’s fix doesn’t check the post type, and the dropbown box is indeed available for all post types. His fix prevents multiple copies of the same dropdown box, which is the problem I reported. Your fix works too, thanks.

    Wasn’t aware of the did_action function. You learn something new everyday!

    I agree that using this method of preventing more than one custom checkbox is better suited.

    However, the check of ‘post type’ == column_name does not control the appearance of the custom checkbox for specific post types, but rather ensures that it only appears if the column named ‘post type’ has been added to the table/listing of posts.

    I’m sorry; you’re quite right. I conflated your code above with another solution I saw for this problem!

    It works smooth, thank you for the solution.

    Thank you for the solution Stephanie and Oshouki! ??

    Thanks for the solution. Works fine. ??

    IS this author still supporting the plugin? I have this issue among others…

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Quick Edit shows multiple (non-functional) boxes of Post Type switch’ is closed to new replies.