Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6985067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:37:54+00:00 2026-05-27T18:37:54+00:00

How can I add a (draggable) meta box to an options page for a

  • 0

How can I add a (draggable) meta box to an options page for a plugin I created? Is this even possible? Because if I look in the docs I see that I can only add it to a ‘post’, ‘page’, ‘link’, or ‘custom_post_type’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:37:55+00:00Added an answer on May 27, 2026 at 6:37 pm

    Yes it’s possible. The code in your previous question was correct but it misses something important or you haven’t added that code to the question.

    Here is a demo plugin that can help you get it working.

    This Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine

    The basic code from the demo plugin is the following. Note that in the full exemple the side meta boxes are not working nor the two columns layout as it was written for WordPress 2.8 and current version is almost 5.0.

    // Source code by Frank Bueltge at gist.github.com/bueltge/757903
    class howto_metabox_plugin {
        function howto_metabox_plugin() {
            add_action('admin_menu', array($this, 'on_admin_menu')); 
            add_action('admin_post_save_howto_metaboxes_general', array($this, 'on_save_changes'));
        }
    
        function on_admin_menu() {
            $this->pagehook = add_options_page('Howto Metabox Page Title', "HowTo Metaboxes", 'manage_options', 'howto_metaboxes', array($this, 'on_show_page'));
            add_action('load-'.$this->pagehook, array($this, 'on_load_page'));
        }
    
        function on_load_page() {
            wp_enqueue_script('common');
            wp_enqueue_script('wp-lists');
            wp_enqueue_script('postbox');
            add_meta_box('howto-metaboxes-contentbox-2', 'Contentbox 2 Title', array($this, 'on_contentbox_2_content'), $this->pagehook, 'normal', 'core');
            add_meta_box('howto-metaboxes-contentbox-additional-1', 'Contentbox Additional 1 Title', array($this, 'on_contentbox_additional_1_content'), $this->pagehook, 'additional', 'core');
        }
    
        function on_show_page() {
            //define some data can be given to each metabox during rendering
            $data = array('My Data 1', 'My Data 2', 'Available Data 1');
            ?>
            <div id="howto-metaboxes-general" class="wrap">
            <?php screen_icon('options-general'); ?>
            <h2>Metabox Showcase Plugin Page</h2>
            <form action="admin-post.php" method="post">
                <?php wp_nonce_field('howto-metaboxes-general'); ?>
                <input type="hidden" name="action" value="save_howto_metaboxes_general" />
    
                <div id="poststuff" class="metabox-holder">
                    <div id="side-info-column" class="inner-sidebar">
                        <?php do_meta_boxes($this->pagehook, 'side', $data); ?>
                    </div>
                    <div id="post-body" class="has-sidebar">
                        <div id="post-body-content" class="has-sidebar-content">
                            <?php do_meta_boxes($this->pagehook, 'normal', $data); ?>
                            <?php do_meta_boxes($this->pagehook, 'additional', $data); ?>
                            <p>
                                <input type="submit" value="Save Changes" class="button-primary" name="Submit"/>    
                            </p>
                        </div>
                    </div>
                    <br class="clear"/>
    
                </div>  
            </form>
            </div>
            <script type="text/javascript">
                //<![CDATA[
                jQuery(document).ready( function($) {
                    // close postboxes that should be closed
                    $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
                    // postboxes setup
                    postboxes.add_postbox_toggles('<?php echo $this->pagehook; ?>');
                });
                //]]>
            </script>
    
            <?php
        }
    
        function on_save_changes() {
            if ( !current_user_can('manage_options') )
                wp_die( __('Cheatin&#8217; uh?') );         
    
            check_admin_referer('howto-metaboxes-general');     
            //process here your on $_POST validation and / or option saving 
            //lets redirect the post request into get request (you may add additional params at the url, if you need to show save results
            wp_redirect($_POST['_wp_http_referer']);        
        }
        function on_contentbox_2_content($data) {
            sort($data);
            ?>
            <p>The given parameter at <b>reverse sorted</b> order are: <em><?php echo implode(' | ', array_reverse($data)); ?></em></p>
            <?php
        }
        function on_contentbox_additional_1_content($data) {
            ?>
            <p>This and the 2nd <em>additional</em> box will be addressed by an other group identifier to render it by calling with this dedicated name.</p>
            <p>You can have as much as needed box groups.</p>
            <?php
        }
    }
    $my_howto_metabox_plugin = new howto_metabox_plugin();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have draggable objects, how can I add remove button to delete this object?
I can not add button to this jquery ui dialog. if possible please give
In HTML5, you can add the attribute draggable to any element -- it works
I can't figure out how to get the options set for draggable and resizeable
I have a UITableView with draggable rows and I can add/remove items. The datasource
Ruby can add methods to the Number class and other core types to get
I can add and remove the last line in my dynamic form and calculate
I know I can add a icon to the Resources.resx file of a project
I know that I can add a HintPath to an external DLLs to help
I know one can add event listener for window.error. However when working with Iframes,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.