• Resolved zuhm89

    (@zuhm89)


    Hi folks,
    Firstable I’m quite new on WordPress so forgive my noobiness.
    After spending a lot of time trying to find some tips about my issue I can’t find anything so I’m trying here.
    For my plugin I registered a Custom Post Type for which I got a bulk action problem.
    On the posts list edit screen I have the bulk action dropdown list and the “doaction” button.
    I can easily trash the posts one by one using the below “trash” action link.
    However when I select several posts and try the default bulk action “move to trash”, the page reloads, the posts get unchecked and nothing happens. They are still in the list as nothing happened. No error displays on the admin panel nor in the log file.

    I read all the register_post_type() documentation, I even tried this tuto to add custom bulk action https://rudrastyh.com/wordpress/custom-bulk-actions.html
    I managed to add a bulk draft action. It appears in the select. Still when I launch the action nothing happens.

    I probably miss something or maybe there are side effects with other pieces of code in my plugin.
    If somebody ever had this problem or have a clue to help me understand what is going wrong it would be much appreciated.

    Regards.

    • This topic was modified 2 years, 6 months ago by zuhm89.
    • This topic was modified 2 years, 6 months ago by zuhm89.
    • This topic was modified 2 years, 6 months ago by zuhm89.
    • This topic was modified 2 years, 6 months ago by zuhm89.
    • This topic was modified 2 years, 6 months ago by zuhm89.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Are there any errors, warnings or notices logged in the error log after you attempt to bulk trash posts?

    I tried just your CPT registration code on my site and bulk delete worked fine there, so it’s not the CPT registration code that’s the problem.

    Eliminate possible outside influence by switching to a default twenty* theme and deactivating all plugins except the one that registers the CPT. If the problem persists now, the problem is somewhere in the plugin itself. Anything that tries to alter an admin process could be the cause.

    Thread Starter zuhm89

    (@zuhm89)

    Hi bcworkz,

    Thank you for taking time to help me.
    You did give me an interesting clue that allowed me to isolate the troublesome piece of code.
    Actually the problem came from the hook manage_posts_extra_tablenav I’m using to add custom export buttons on the posts list screen.
    In my plugin this hook calls a function that adds an HTML <form> to handle those buttons.
    This is the crux of the matter, it seems that we can’t use this HTML element here.
    If I remove the <form> element and just let the <input> elements I still can get the required informations for exportation using $_GET and there’s no conflict with bulk submission anymore.
    I actually don’t know in detail why it is like that and if you can explain that behavior to me I would me grateful.

    Regards,

    • This reply was modified 2 years, 6 months ago by zuhm89.
    Moderator bcworkz

    (@bcworkz)

    The entire table is already a form element which reloads edit.php on submit. I believe nesting additional forms within would be invalid HTML? You can add additional input fields, but they’d need to be named in a way that’s acceptable to edit.php as proper query string elements. Setting certain WP_Query vars would be acceptable. If your field has some other purpose than what edit.php can handle, you’d need to implement what happens via jQuery and Ajax or something along those lines.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bulk trash doesn’t work’ is closed to new replies.