WP_List_Table and an Extra Nonce

I am working on a WordPress plugin. For part of it I am adding a Metabox onto the Post Edit screen in the admin section. However things stop working if I add a WP_List_Table. That is because by default the list table adds a _wpnonce field, even though there is already one there for the Edit page.

This of course messes things up and prevents you from saving or updating. Not awesome. The field is output in the display_tablenav() function in the base list_table class. It looks like there has been a fix submitted, lets hope it gets into an upcoming version.

Until then, you can simply override the display_tablenav() function with a blank function or one that provides similar functionality.


Posted

in

by

Tags:

Comments

3 responses to “WP_List_Table and an Extra Nonce”

  1. Avi Avatar
    Avi

    Thank you, you saved me so much waste of time and a lot of headache. I just override the display_tablenav() function with a blank function.

  2. Joel Warren Avatar

    Kudos, wasted a couple hours trying to pinpoint why saving a post wasn’t working, until I found this post. Simple solution

  3. Rutger de Jong Avatar
    Rutger de Jong

    Life-saver. I couldn’t find out where the extra _nonce came from. After disabling all other possibilities it had to be in a custom WP_List_Table, which led me to your site. Sad to see this bug still exists in the latest versions of WordPress though.