WordPress.org

Forums

[resolved] Re-ordering metaboxes (2 posts)

  1. joselov
    Member
    Posted 2 years ago #

    Hi all!

    When I register a custom taxonomy (non hierarchical), its metabox is adding to the side column of my post composing panel.
    I want to re-order its position. I am removing it first and adding it again to my desire position. My problem is that a don´t know what is the callback to call my custom taxonomy metabox.

    Anybody knows how could i figure out it? I am looking inside wp-admin>includes>meta-boxes.php, but here there are only the meta-boxes by default.

    PS. Sorry to open other post in forum but i can´t mark the other as resolved.

  2. joselov
    Member
    Posted 2 years ago #

    I found the solution by myself.
    To anyone that is having the same problem, rather than remove_meta_box and add_meta_box, simply include this:

    // Global the $wp_meta_boxes variable (this will allow us to alter the array)
    global $wp_meta_boxes;
    
    // Then we make a backup of your widget
    $my_widget = $wp_meta_boxes['dashboard']['normal']['core']['{widget id here}'];
    
    // We then unset that part of the array
    unset($wp_meta_boxes['dashboard']['normal']['core']['{widget id here}']);
    
    // Now we just add your widget back in
    $wp_meta_boxes['dashboard']['side']['core']['{widget id here}'] = $my_widget;

    inside a function and 'add_action' with 'add_meta_boxes' hook.

    I find this here.

Topic Closed

This topic has been closed to new replies.

About this Topic