0

I am working on theme development and I have to move my featured image metabox so that it is more user friendly. I searched for move featured image metabox.

Thanks Allah for I have found the solution

For a test I found that the problem is that it works for "post" post type not custom post type

# Information

WP version: 5.0.3 PHP version: 7.2.11 I am using Laragon

# This is the code

add_action('do_meta_boxes', 'ppdc_screenshot_move_metabox' );

function ppdc_screenshot_move_metabox() {
    remove_meta_box( 'postimagediv', 'ppdc-screenshot', 'side' );
    add_meta_box('postimagediv', 'Screenshot Image', 'post_thumbnail_meta_box', 'ppdc-screenshot', 'normal', 'high');
}
0

Hope this code may be help you.

You can read the full parameters for add_meta_box in the codex. I also listed them here:

add_meta_box( $id, $title, $callback, $page, $context, $priority, $callback_args );

function wpt_add_event_metaboxes() {
    add_meta_box(
        'wpt_events_location',      // $id
        'Event Location',           // $title
        'wpt_events_location',      // $callback
        'events',                   // $page (Post Type)
        'side',                     // $context
        'default'                   // $priority
    );
}
add_action( 'add_meta_boxes', 'wpt_add_event_metaboxes' );

For the example above:

  • $id is “wpt_events_location”- or the html id that will be applied to this metabox.
  • $title is “Event Location”. This appears at the top of the new metabox when displayed.
  • $callback is the function “wpt_events_location” which will load the html into the metabox.
  • $page is “events”, the name of our custom post type.
  • $context is “side”. If you wanted it to load below the content area, you could put “normal”.
  • $priority controls where the metabox will display in relation to the other metaboxes. You can put “high”, “low” or “default”.
  • Thanks for this quick answer .. I know how to use add_meta_box() function ... I've solve my problem It was my internet Cache because I used drag features before I added my metabox so I think my browser forced to stay in the side but when I clear my all of my browser data ( internet history, cache, session etc ) it's just show up in normal position :D This is Solution I've Found – Nobir Feb 13 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.