Top Related Projects
Lets you easily create metaboxes with custom fields that will blow your mind.
CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind.
Yoast SEO for WordPress
Exposes Advanced Custom Fields Endpoints in the WordPress REST API
Quick Overview
Meta Box is a powerful WordPress plugin that provides developers with a toolkit to create custom meta boxes and custom fields in WordPress. It simplifies the process of adding custom data to posts, pages, and custom post types, offering a wide range of field types and features for enhanced content management.
Pros
- Extensive field types and options for customization
- Developer-friendly with clean, well-documented code
- Lightweight and optimized for performance
- Active development and community support
Cons
- Steeper learning curve for beginners compared to some alternatives
- Advanced features require premium extensions
- May require additional coding knowledge for complex implementations
- Limited built-in front-end display options
Code Examples
- Creating a simple meta box with text and date fields:
add_filter( 'rwmb_meta_boxes', 'custom_meta_box' );
function custom_meta_box( $meta_boxes ) {
$meta_boxes[] = [
'title' => 'Custom Information',
'fields' => [
[
'name' => 'Full Name',
'id' => 'full_name',
'type' => 'text',
],
[
'name' => 'Birth Date',
'id' => 'birth_date',
'type' => 'date',
],
],
];
return $meta_boxes;
}
- Retrieving and displaying custom field values:
$full_name = rwmb_meta( 'full_name' );
$birth_date = rwmb_meta( 'birth_date' );
echo "<p>Name: $full_name</p>";
echo "<p>Birth Date: $birth_date</p>";
- Creating a meta box with a repeatable group of fields:
add_filter( 'rwmb_meta_boxes', 'education_meta_box' );
function education_meta_box( $meta_boxes ) {
$meta_boxes[] = [
'title' => 'Education',
'fields' => [
[
'id' => 'education',
'type' => 'group',
'clone' => true,
'fields' => [
[
'name' => 'Degree',
'id' => 'degree',
'type' => 'text',
],
[
'name' => 'Year',
'id' => 'year',
'type' => 'number',
],
],
],
],
];
return $meta_boxes;
}
Getting Started
- Install and activate the Meta Box plugin from the WordPress repository.
- Add the following code to your theme's
functions.php
file or a custom plugin:
add_filter( 'rwmb_meta_boxes', 'custom_meta_box' );
function custom_meta_box( $meta_boxes ) {
$meta_boxes[] = [
'title' => 'Custom Fields',
'fields' => [
[
'name' => 'Text Field',
'id' => 'text_field',
'type' => 'text',
],
],
];
return $meta_boxes;
}
- The custom meta box will now appear in the post editor.
- To display the field value, use
<?php echo rwmb_meta( 'text_field' ); ?>
in your template files.
Competitor Comparisons
Lets you easily create metaboxes with custom fields that will blow your mind.
Pros of Custom-Metaboxes-and-Fields-for-WordPress
- More extensive documentation and examples
- Larger community and longer history of development
- Better integration with WordPress core functions and hooks
Cons of Custom-Metaboxes-and-Fields-for-WordPress
- Less frequent updates and maintenance
- More complex setup process for beginners
- Limited built-in field types compared to Meta Box
Code Comparison
Custom-Metaboxes-and-Fields-for-WordPress:
$meta_boxes['test_metabox'] = array(
'id' => 'test_metabox',
'title' => 'Test Metabox',
'pages' => array('page'),
'fields' => array(
array(
'name' => 'Text Input',
'id' => $prefix . 'text',
'type' => 'text',
),
),
);
Meta Box:
add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
function your_prefix_register_meta_boxes( $meta_boxes ) {
$meta_boxes[] = array(
'title' => 'Test Metabox',
'fields' => array(
array(
'name' => 'Text Input',
'id' => 'text',
'type' => 'text',
),
),
);
return $meta_boxes;
}
Both libraries offer similar functionality for creating custom metaboxes in WordPress, but Meta Box provides a more streamlined and actively maintained solution with a wider range of field types and extensions.
CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind.
Pros of CMB2
- More extensive field types and options out-of-the-box
- Strong community support and active development
- Better integration with third-party plugins and themes
Cons of CMB2
- Steeper learning curve for beginners
- Less intuitive API for creating custom field types
- Slightly more complex setup process
Code Comparison
Meta Box:
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
$meta_boxes[] = [
'title' => 'Test Meta Box',
'fields' => [
['type' => 'text', 'name' => 'Name'],
],
];
return $meta_boxes;
} );
CMB2:
add_action( 'cmb2_admin_init', function() {
$cmb = new_cmb2_box( [
'id' => 'test_metabox',
'title' => 'Test Meta Box',
] );
$cmb->add_field( [
'name' => 'Name',
'id' => 'name',
'type' => 'text',
] );
} );
Both Meta Box and CMB2 are powerful tools for creating custom meta boxes in WordPress. Meta Box offers a more straightforward API and easier setup, while CMB2 provides more advanced features and flexibility. The choice between them depends on the specific project requirements and developer preferences.
Yoast SEO for WordPress
Pros of wordpress-seo
- Comprehensive SEO solution with features like content analysis, XML sitemaps, and social media integration
- User-friendly interface with clear guidelines for optimizing content
- Regular updates and active community support
Cons of wordpress-seo
- Can be resource-intensive, potentially slowing down website performance
- Some advanced features are locked behind a premium paywall
- May have conflicts with other SEO plugins or themes
Code Comparison
meta-box:
$meta_boxes[] = [
'title' => 'Custom Fields',
'fields' => [
['name' => 'Field Name', 'id' => 'field_id', 'type' => 'text'],
],
];
wordpress-seo:
add_filter('wpseo_metabox_prio', function() {
return 'low';
});
The meta-box code snippet demonstrates the creation of custom meta boxes, while the wordpress-seo example shows how to adjust the priority of the Yoast SEO metabox. This highlights the different focus areas of the two plugins: meta-box for custom fields and wordpress-seo for SEO optimization.
Exposes Advanced Custom Fields Endpoints in the WordPress REST API
Pros of acf-to-rest-api
- Specifically designed to expose Advanced Custom Fields (ACF) data to the WordPress REST API
- Lightweight and focused on a single purpose
- Easy to integrate with existing ACF setups
Cons of acf-to-rest-api
- Limited to ACF integration, less versatile for other custom field needs
- Requires ACF plugin to be installed and active
- May have fewer customization options compared to more comprehensive solutions
Code Comparison
meta-box:
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
$meta_boxes[] = [
'title' => 'Custom Fields',
'fields' => [
['name' => 'Field Name', 'id' => 'field_id', 'type' => 'text'],
],
];
return $meta_boxes;
} );
acf-to-rest-api:
// No additional code required for basic functionality
// ACF fields are automatically exposed to the REST API
// Customization can be done through filters if needed
The code comparison shows that meta-box requires more manual setup for custom fields, while acf-to-rest-api leverages existing ACF configurations to expose data to the REST API with minimal additional code.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Meta Box - A Framework for Dynamic WordPress Websites
Meta Box is a professional framework that makes building and customizing a website with dynamic data and content in WordPress fun and easy.
Meta Box helps you add custom fields and dynamic data to posts, pages, custom post types, forms and anywhere you want using over 40+ different field types such as text, images, file upload, checkboxes, and more.
On top of that, each WordPress custom field type has extensive internal options for unlimited content possibilities. Complete customization and control is just a few clicks away.
Meta Box Lite
We recommend using Meta Box Lite, a feature-rich free UI version of Meta Box that provides UI and all free features for managing custom fields and dynamic content on WordPress, including post types, taxonomies, custom fields, and relationships.
Meta Box Features
Create any type of custom fields in WordPress
That's right â any type. No matter where you need to insert custom data and features, Meta Box's WordPress custom fields have your back, and with infinite options to boot.
Here are just a few of the data types you can customize:
- Posts
- Pages
- Custom post types (you can also use our free plugin MB Custom Post Types & Custom Taxonomies to create custom post types and custom taxonomies)
- Taxonomies
- Settings pages or Customizer sections
- User profile pages
- Post comments
A wide-range of field types and options
Take your standard WordPress custom field and imagine it infinitely expanded. That's how many options Meta Box gives you:
- Meta Box supports 40+ built-in WordPress custom field types for all your needs including text, textarea, WYSIWYG editor, image, file, post, select, checkbox, radio buttons, date/time picker, taxonomy, user, oembed and more to come.
- Not enough? You can also effortlessly create your own field type.
- Meta Box supports cloning fields for most field types including the WYSIWYG editor field. It also supports repeatable field groups.
It's developer-friendly
As a developer, you have enough on your plate. You shouldn't have to create an entirely new system for each project. Use Meta Box to your full advantage.
You can use Meta Box and its custom fields for any custom post type in WordPress on as many websites as you want so you can use it on client projects as well.
- Has an ultra-lightweight, yet powerful API that won't overload your site.
- Add only what you need instead of getting stuck with a bundle of features you don't even want that bloat your site.
- Meta Box easily integrates with any theme and plugin, and supports Composer!
- We use the native WordPress meta data storage and functions for ease of use and lightning-fast processing.
- Has a lot of actions and filters so you can build or change a site's appearance and behavior in the plugin.
Don't love coding? You're in luck!
If you prefer a more visual system to create custom fields in WordPress, please use Meta Box Lite, a feature-rich free UI version of Meta Box that provides:
- All the power of Meta Box without touching a single line of code.
- Designer-friendly, lightweight and work at top-notch speeds.
- Export your custom fields and settings to PHP. Then, add it to a new site without needing to install this extension for an incredibly lightweight option.
Free Extensions
- Migrations from ACF or Toolset.
- Integrations with all page builder plugins like Elementor, Beaver Builder, Divi, Bricks, Brizy, etc.
- Integrations with SEO plugins like Yoast SEO, Rank Math, or Slim SEO.
- MB Builder: Create custom meta boxes and custom fields in WordPress using a user-friendly drag-and-drop interface.
- MB Comment Meta: Add WordPress custom fields to comments in WordPress.
- MB Custom Post Types & Custom Taxonomies: Create and manage custom post types and taxonomies with UI.
- MB Relationships: Create as many connections as you want from post-to-post or page-to-page.
- MB Rest API: Pull all meta values from posts and terms into the WP REST API responses.
- MB FacetWP Integrator: Integrates Meta Box and FacetWP to make custom fields searchable and filterable.
- MB Text Limiter: Limit the number of characters or words entered for text and textarea fields.
Premium Extensions
- MB Admin Columns: Display WordPress custom fields in table columns in admin.
- MB Blocks: Create custom Gutenberg blocks with PHP, using the same syntax in Meta Box.
- MB Columns: Display eye-catching custom fields in WordPress by putting them into 12-column grids.
- MB Conditional Logic: Add visibility dependency for custom meta boxes and custom fields in WordPress.
- MB Custom Table: Save custom fields to custom tables instead of the default meta tables to reduce your database's size and increase its performance.
- MB Frontend Submission: Create frontend forms for users to submit posts.
- MB Geolocation: Automatically and instantly populate location data with the power of the Google Maps Geolocation API.
- MB Group: Create repeatable groups for better appearance and structure.
- MB Include Exclude: Show or hide meta boxes by ID, page template, taxonomy, or custom function.
- MB Revision: Track changes to custom fields in WordPress with revisions. You can compare and restore the changes smoothly.
- MB Settings Page: Create settings pages for themes, plugins or websites with beautiful syntax.
- MB Show Hide: Toggle meta boxes by page template, post format, taxonomy and category.
- MB Tabs: Painlessly create tabs for meta boxes with multiple styles and icons.
- MB Template: Make defining custom meta boxes and WordPress custom fields way easier with templates.
- MB Term Meta: Add custom fields to categories, tags or custom taxonomies.
- MB Tooltip: Display help information for custom fields with tooltips.
- MB User Meta: Add custom fields to users.
- MB User Profile: Build login, register and edit profile forms for users.
- MB Views: Outputting custom fields and build front-end templates for WordPress without touching theme files.
Detailed Documentation
We provide regularly updated, and extensive documentation as well as tutorials on how to use MetaBox and custom fields in WordPress to your advantage as well as in the most efficient way possible.
Here are a few guides to quickly get you started with Meta Box and creating your own WordPress custom fields:
Installation
We recommend using Meta Box Lite, a feature-rich free UI version of Meta Box that provides UI and all free features for managing custom fields and dynamic content on WordPress, including post types, taxonomies, custom fields, and relationships.
To install Meta Box Lite, go to this page and download it.
If you want to use Meta Box, please follow these steps:
- Visit Plugins > Add New inside your WordPress dashboard
- Search for Meta Box
- Click the Install Now button to install the plugin
- Click the Activate button to activate the plugin
Contributors
- Tran Ngoc Tuan Anh a.k.a Rilwis - Initial & lead developer
- Franz Josef Kaiser
- Omnicia
- ruanmer
- PerWiklander
- funkedgeek
- truongwp
Changelog
You might also like
If you like this plugin, you might also like our other WordPress products:
- Slim SEO - A fast, lightweight and full-featured SEO plugin for WordPress with minimal configuration.
- GretaThemes - Free and premium WordPress themes that clean, simple and just work.
- Auto Listings - A car sale and dealership plugin for WordPress.
Top Related Projects
Lets you easily create metaboxes with custom fields that will blow your mind.
CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind.
Yoast SEO for WordPress
Exposes Advanced Custom Fields Endpoints in the WordPress REST API
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot