How To Make Meta Box Appear Above Editor In WordPress

This should be a relatively simple task to achieve in most scenarios, there are circumstances where it is not. This guide will show you what you need to do to make custom meta boxes appear above the default WordPress editor in the admin area.

When you are adding a new meta box to the post editor in admin, setting the context to advanced will give it priority over the other meta boxes, making it show up at the top. The code below will show you how to do this.

add_meta_box('test', __('test'), 'test', 'post', 'advanced');

The problem you may sometimes encounter is that using the advanced argument does nothing to alter the order in which the boxes appear. There is a simple change you can make if you want this meta field to appear above the main wordpress editor. The code below will force wordpress to push out the advanced meta boxes early. This will mean they will appear at the very top of the new post and edit post form.

add_action('edit_form_after_title', function() {
    global $post, $wp_meta_boxes;
    do_meta_boxes(get_current_screen(), 'advanced', $post);
    unset($wp_meta_boxes[get_post_type($post)]['advanced']);
});

Related Articles

Related Questions

Help with Frequent BSOD: IRQL_NOT_LESS_OR_EQUAL

Hey everyone! I upgraded my PC last month, but since early June, I've been dealing with random Blue Screen of Death (BSOD) errors showing...

SMTP Traffic from On-Prem Exchange Blocked after ISP Change – Need Help!

Hey everyone, I recently migrated to a new ISP and updated our edge network. After configuring the firewall and NAT rules, our on-premise Exchange...

Troubleshooting Frequent BSODs: IRQL_NOT_LESS_OR_EQUAL Help Needed

I upgraded my PC last month, and since early June, I've been dealing with random Blue Screens of Death (BSODs) showing the error code...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Tools

Online Hash Generator – String to Hash Converter

Need to quickly generate a hash from a string? Whether you're verifying file integrity, securing data, or just experimenting with cryptographic tools, this simple...

Convert CSV To HTML Table

Need to quickly turn CSV data into an HTML table? Whether you're copying data from Excel, Google Sheets, or another spreadsheet, this tool makes...

Student Group Randomizer

Creating fair and balanced groups in the classroom can be time-consuming — especially when you're trying to avoid repetition, manage different skill levels, or...

Random Group Generator

Need to split a list of people, items, or ideas into random groups? Our free Random Group Generator makes it quick and easy. Whether...

Flip Text Upside Down – Free Online Tool

Ever wanted to flip your text upside down just for fun or to grab someone’s attention in a creative way? This free online Upside...

Raffle Ticket Generator

If you're running a fundraiser, charity draw, or local event and need raffle tickets fast, this free online tool lets you generate and print...

Latest Posts

Latest Questions