How to add meta box to backend menu page

/**
 * Instantiates the class
 */
add_action( 'admin_init', array( 'call_someClass', 'init' ) );

/**
 * The Class
 */
class call_someClass {
    const LANG = 'exch_lang';

    public static function init() {
    $class = __CLASS__;
    new $class;
    }

    public function __construct() {
    // Abort if not on the nav-menus.php admin UI page - avoid adding elsewhere
    global $pagenow;
    if ( 'nav-menus.php' !== $pagenow )
                    return;

        $this->add_some_meta_box();
    }

    /**
     * Adds the meta box container
     */
    public function add_some_meta_box(){
        add_meta_box(
            'info_meta_box_'
            ,__( 'Example metabox', self::LANG )
            ,array( $this, 'render_meta_box_content' )
            ,'nav-menus' // important !!!
            ,'side' // important, only side seems to work!!!
            ,'high'
        );
    }

    /**
     * Render Meta Box content
     */
    public function render_meta_box_content() {
        echo '<p>Example text</p>';
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>