WordPress.org

Ready to get started?Download WordPress

Forums

Post Type Switcher
Quick Edit shows multiple (non-functional) boxes of Post Type switch (12 posts)

  1. normadize
    Member
    Posted 1 year ago #

    As seen in the screenshot:

    https://www.dropbox.com/s/99bg2lecp2a62em/SNAG_Program-0075.png

    There are as many dropdown boxes of "Post Type" as there are post types (I have 3 custom post types). Most of them don't work either, i.e. changing the post type and pressing Update doesn't actually change it.

    If I go to the full edit screen, then it works fine.

    Using latest version of the plugin and WP at the time of this writing.

    Happy to provide more info if required.

    Cheers.

    http://wordpress.org/extend/plugins/post-type-switcher/

  2. Oshouki
    Member
    Posted 1 year ago #

    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 ...
    }
  3. normadize
    Member
    Posted 1 year ago #

    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.

  4. Oshouki
    Member
    Posted 1 year ago #

    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

  5. Stephanie Leary
    Member
    Posted 1 year ago #

    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;
  6. normadize
    Member
    Posted 1 year ago #

    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.

  7. Oshouki
    Member
    Posted 1 year ago #

    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.

  8. Stephanie Leary
    Member
    Posted 1 year ago #

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

  9. Huroman
    Member
    Posted 1 year ago #

    It works smooth, thank you for the solution.

  10. paul-g
    Member
    Posted 7 months ago #

    Thank you for the solution Stephanie and Oshouki! :-)

  11. Navjot Singh
    Member
    Posted 5 months ago #

    Thanks for the solution. Works fine. :)

  12. Devin Walker
    Member
    Posted 5 months ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.