Support » Fixing WordPress » Plugin Admin Page Sortable Metaboxes

  • Resolved Josh


    Moderator and Editor Customizer


    I have successfully created my metaboxes and they are opening/closing and dragging properly.

    However, they will NOT save their positions (or open/close status) when refreshing the page.

    I have read about using various enqueue scripts, nonces, and custom javascript… but I am at a loss. I feel I am so close, and just missing some code somewhere.

    Can someone point me to how WordPress saves the sortable metaboxes?

    Here is a snippet of my code:

    I have also read it’s necessary to call the add_metabox from outside the add_options_page function. But when I do this, the metabox disappears from my plugin page.

    Thank you very much to anyone who can help.

    UPDATE: I am using the following code (I picked up somewhere).

    <form action="" method="">
              <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
              <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
              <input type="hidden" name="action" value="save_dashboard_settings" />

    … as well as the wp_enqueue_script('dashboard'); command.

Viewing 1 replies (of 1 total)
  • Josh


    Moderator and Editor Customizer

    I got it working. I decided to completely re-write my admin page to take advantage of the “screen-options” tab at the top of the screen.

    Thanks though.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin Admin Page Sortable Metaboxes’ is closed to new replies.