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

Best Budget Tablets for Watching Movies?

Hey everyone! I'm on the hunt for a tablet to gift my dad for his birthday. His main use will be streaming movies and...

Will reinstalling Windows mess up my dual boot with Ubuntu?

Hey everyone! I'm currently using Ubuntu as my main operating system, but I'm having trouble getting DaVinci Resolve to work on Linux. Because of...

What’s the Deal with Azure and Microsoft 365?

I'm a bit puzzled about Azure and its relationship with Microsoft 365. Is Azure actually part of Microsoft 365, or is it a completely...

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