WordPress Meta Boxes, Taxonomy Settings and Options Pages

The Great Time Saver – this plugin allows you to create metaboxes for posts, settings for taxonomy terms and custom option pages without affecting the website performance!

The Fastest Metabox Plugin

You know, I'm not just saying that. One of my subscribers provide me the performance test result he made. You can find it here

Default input fields - text, checkbox, textarea, select, radio buttons for WordPress Pages.

Taxonomies Support

In WordPress 4.4 the wp_termmeta table was intruduced. It means that now we can easily create additional settings for each taxonomy term.

Add image uploader field in tags

Option Pages Support

Create new settings pages or add options to the existing ones, like «General», «Writing», «Reading» etc.

Add settings fields to the General Settings page

No GUI

This plugin is for creating user interfaces, but it doesn't mean that it should have its own UI - one of the reasons why the plugin is so fast. Basic PHP knowledge required.

$metabox = array(
	// ID of the metabox and custom field name prefix
	'id'	=>	'test1',
 
	// Only users with this capability can see and use the metabox
	'capability' =>	'edit_posts',
 
 	// Title of the metabox DIV
	'name'	=>	'Default input fields',
 
	// Custom post types names
	'post_type'	=>	array('post', 'page'),
 
	// array of fields, in this example it is only text field
	'args'	=>	array( 
		array(
			'id'	=> 'textexample',
			'label' => 'Text',
			'description' => 'Text field description, <code>HTML</code> tags are supported',
			'type'	=> 'text', // "text", "checkbox", "textarea", "radio" etc etc
			'placeholder' 	=> 'Placeholder'
		)
	)
);
 
// just pass options here and that's all - metabox is created
if ( class_exists( 'trueMetaBox' ) ) new trueMetaBox( $metabox );

Support

I'm always here if you need my help.
Please leave your question here or contact me if you need assistance with the plugin.

Default input fields - text, checkbox, textarea, select, radio buttons for WordPress Pages.

Speed Up the Websites and Save lots of your Time

Just for 30$

Get the plugin or to learn more

About me and Why I decided to Create this Plugin

I’m a developer.

On almost every website I working with, I use custom settings pages or settings for posts (custom fields). And my main priorities every time are to make WordPress admin area a very friendly place for users and to make a website lightning fast.

I do not like the default «Custom Fields» metabox because it is very unclear for any user (it was unclear for me as well). And it becomes the bigger problem when you need to emulate checkbox, selects, image uploaders.

I do not like ready metabox plugins because: 1) most of them create a custom post type just for the plugin settings! It’s horrible. 2) developers of such plugins tried to do everything as beautiful as it can be even if it makes the WordPress dashboard twice slower.

So, for a very long time I coded metaboxes and option pages by myself in functions.php (or so). But then I understood that I spend so much time to code the metaboxes every time and the idea appeared to create a plugin to simplify and speed up the process.

1. Metaboxes for Posts, Pages, Custom Post Types #

How to create a metabox?

$metabox = array(
	// ... 
	// metabox parameters here, name => value
	// ...
	'args' => array( // array of fields
 
		array(
			// ... 
			// field parameters here, name => value
			// ...
		),
		array(
			// ... 
			// field parameters here, name => value
			// ...
		)
		// ... more fields here
	)
 
);
// create a metabox from our parameters
new trueMetaBox( $metabox );

Now let’s create a very simple metabox for pages with a text field and a checkbox.

$metabox = array(
 
	 // ID of the metabox and custom field name prefix
	'id' =>	'my',
 
	// Only users with this capability can see the metabox
	'capability' => 'edit_posts', 
 
	 // metabox title
 	'name' => 'Misha\'s test metabox with input text and checkbox',
 
	// custom post types names, you can use array( 'page', 'post', 'your_type' )
	'post_type' => array('page'),
 
	// metabox position: low | high | default
	'priority' => 'high',
 
	// array of all metabox input field and their params
	'args' => array(
 
		/* simple text input */
		array(
			'id'	=> 'textexample',
			'label' => 'Text',
			'description' => 'Text field description, <code>HTML</code> tags are supported',
			'type'	=> 'text',
			'placeholder' 	=> 'It is a placeholder...'
		),
 
		/* checkbox input */
		array(
			'id'	=> 'checkboxexample',
			'label' => 'Checkbox',
			'description' => 'Checkbox label, <code>HTML</code> tags are supported',
			'type'	=> 'checkbox',
			'capability' => 'manage_options', // so only admin can see this field
			'default' => 'on' // checkbox marked checked as default
		)
	)
 
);
 
new trueMetaBox( $metabox );

You can insert the code to your theme functions.php (if you do not know where).

Metabox with a text input and with a checkbox creating with the help of my plugin less than in 1 minute.
As you can see, the checkbox is checked by default :)
type example supports
text
input type text field for metabox
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'type'	=> 'text',
	'capability' => '',
	'placeholder' => '',
	'default'  => ''
),
checkbox
input type checkbox field example
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'checkbox',
	'default'  => '' // on
),
select
option select field example
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'select',
	'args'  => array(
		'Name' => 'Value',
		'Name 2' => 'Value 2'
	),
	'default' => ''
),
multiselect
Select2 based multiselect fields.
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'multiselect',
	'args'  => array(
		'Dombay'=>'dombay',
		'Elbrus'=>'elbrus',
		'Roza Khutor'=>'roza-hutor'
	),
	'default' => array( 'dombay' )
),
radio
radio button for WordPress meta boxes
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'radio',
	'args' => array(
		'Radio button 1'=>'Value 1',
		'Radio button 2'=>'Value 2'
	),
	'default' => 'Value 1'
),
textarea
Example of textarea usage for WP metabox
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'textarea',
	'placeholder' => ''
	'default' => ''
),
color
Color Picker field in WordPress for our metabox
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'color',
	'default' => '' // #0099cc
),
editor
TinyMCE and HTML (quicktags) editor for your metabox and option page.
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'editor',
	'editor_args' => array(),
	'default' => ''
),

editor_args are the parameters, supported by the third argument of wp_editor() WordPress function.

image
Upload Image for your posts, terms of option pages.
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'image',
	'default' => 1110 // attachment ID
),

The image uploader functionality is similar to WordPress default Featured Images for posts. Click on the button to open a media gallery, or click the image if the image is already set. If you’re interested to know how to use this uploader for your own code, this tutorial will be helpful for you.

file
Upload files for WordPress metaboxes and option pages.
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'file',
	'default' => ''
),
video
Input text with video preview.
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'video',
	'default' => ''
),
map
Google Maps for your metabox or for your options pages with Locate me button.
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'capability' => '',
	'type'	=> 'map',
	'default' => '' // address
	'default_lat' => '-25.363',
	'default_lng' => '131.044',
),
getposts
Select posts in metabox
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'placeholder' => '',
	'type'	=> 'getposts',
	'multiple' => true, // default: false
	'post_type' => array( 'post', 'page' )
)

Now it is so easy to create your own related posts block or even something more cool.

getterms
Select terms of multiple taxonomies in the same metabox field.
array(
	'id'	=> '',
	'label' => '',
	'description' => '',
	'placeholder' => '',
	'type'	=> 'getterms',
	'multiple' => true, // default: false
	'taxonomy' => 'post_tag'
)

taxonomy parameter doesn’t support array values here, defaults to category.

type example supports

2. Metaboxes for Categories, Post Tags, Custom Taxonomу Terms #

Creating settings for a specific taxonomy terms is as simple as create a metabox. Just use another class name and change a couple parameters in it.

$taxonomy = array(
 
	// ID is the part of term metadata
	// for posts you maybe know get_post_meta() function, for terms it is get_term_meta()
	// get_term_meta( $term_id, 'test5_imageexample', true ) )
	'id' => 'test5',
 
	// this settings is available only for users with this capability
	'capability' => 'edit_posts',
 
	// you can specify more than one taxonomy, for example array( 'category', 'post_tag', 'product_cat' )
	'taxonomy' => array('post_tag'),
 
	// fields are below
	'args' => array(
 
		// field 1
		array(
			// it is also the part of term meta key
			'id' => 'imageexample',
			'label'	 => 'Country flag',
			'description' => 'description',
			'type' => 'image' // all types and their params are described in the table above.
		)
	)
 
);
 
if( class_exists( 'trueTaxonomyMetaBox' ) ) // you can check if my plugin is active but it is not necessary
	new trueTaxonomyMetaBox( $taxonomy );

The result:

Adding the custom image uploader field to your tags taxonomy. The code is above this image.
So, on the screenshot above I decided to use default post tags to separate posts by countries without creating a custom taxonony.

3. Custom Option Pages with my plugin #

Creating New Option Pages

Yes, yes, I know that it is better to add style customization into Appearance > Customizer, but this is just an example.

$options = array(
	// yes, slug is the part of the option name, so, to get the value, use
	// get_option( '{SLUG}_{ID}' ); 
	// get_option( 'styles_headercolor' ); 
	'slug'	=>	'styles',
 
	// h2 title on your settings page
	'title' => 'Customize your website appearance here',
 
	// this displayed in admin menu, try to make it short
	'menuname' => 'Design',
 
	'capability'=>	'manage_options',
 
	// WordPress option pages consist of sections, so, 
	// at first we create an array of sections and add fields in each section
	'sections' => array(
 
		// first section
		array(
 
			// section ID isn't used anywhere, but it is required
			'id' => 'headerfsfsfsdf',
 
			// section name is displayed as h2 heading
			'name' => 'Header options',
 
			// and only now the array of fields
			'fields' => array(
				array(
					'id'			=> 'headercolor',
					'label'			=> 'Header Color',
					'type'			=> 'color', // table of types is above
					'default'		=> '#333'
				),
				array(
					'id'	=> 'headerfixed',
					'label' => 'Fixed Header',
					'description' => 'Make the header fixed on the all pages of your website.',
					'type'	=> 'checkbox'
				)
			)
		),
 
		// second section
		array(
			'id' => 'advanceddfsdfsdf',
			'name' => 'Advanced Customizations',
			'fields' => array(
				array(
					'id'	=> 'social',
					'label' => 'Show Share Buttons',
					'type'	=> 'checkbox',
					'default' => 'on'
				),
 
				// yes, I know that WordPress has its own beautiful custom CSS option :)
				array(
					'id'	=> 'custom_css',
					'label' => 'Custom CSS',
					'type'	=> 'textarea'
				)
			)
		)
	)
);
 
if( class_exists( 'trueOptionspage' ) )
	new trueOptionspage( $options );

So, if I add the above code to the functions.php file (for example) while my plugin is active, that’s what will appear in admin area:

Example of the settings page, created with my plugin in less than 10 minutes.

Add More Settings to WordPress Default Option Pages

$generaloptions = array(
 
	// general, writing, reading, discussion, media, permalink
	'slug' => 'general',
	'sections' => array(
		array(
 
			// you can create a new section if you specify your custom ID ( not "default" ) and name parameter
			// if you use id "default" and don't specify a name, the fields will be added just after the default ones
			'id' => 'default',
 
			'fields' => array(
 
				array(
					'id'	=> 'phone',
					'label' => 'Phone',
					'type'	=> 'text'
				),
 
				array(
					'id' => 'mapexample',
					'label' => 'Office Location',
					'type' => 'map'
				)
			) 
		) 
	)
);
 
if( class_exists( 'trueOptionspage' ) )
	new trueOptionspage( $generaloptions );
You can easily add any options to WordPress default settings pages.

Compare the Performance of My Plugin with the Most Popular Metabox Plugins #

My blog reader compared my plugin (True Metabox) with popular Advanced Custom Fields and Toolset Types and sent me the result table (click to enlarge).

Compare my plugin speed with the other similar plugins.

Do you agree that it is much better to use my True Metabox plugin for good website performance?

For collecting this data he used the following piece of code.

function wp_usage(){
	printf( ('SQL: %d за %s сек. '), get_num_queries(), timer_stop(0, 3) );
	if ( function_exists('memory_get_usage') )
		echo round( memory_get_usage()/1024/1024, 2 ) . ' MB ';
}
add_filter('admin_footer_text', 'wp_usage');

2.1 – May 16, 2017

  • Added: Swedish translation (thanks to Fredric Österlund).
  • Select2 fields are now supported by taxonomies and option pages.

2.0 – May 8, 2017

  • Added: New fields that allow to search and select posts (any post type) and terms (any taxonomy). Multiple selection is supported.
  • Chosen script replaced with Select2.

1.1 – June 9, 2016

  • Added: Google Maps are now in the same language as the website.
  • Improved: Reduced the number of SQL queries in Dashboard.

1.0

  • Plugin release date.

Comments 10

  • Hi, Misha! What about frontend? How to show that meta in frontend?

    • MishaAuthor June 24, 2017 at 14:09

      Hi Alex,

      With the following functions:
      get_post_meta() — for posts/post types
      get_term_meta() — for categories/post tags/taxonomies
      get_option() — for option pages

      I mentioned these functions in the examples above.

  • Hi Misha!
    I ‘ve tested and used your Metabox plugin and I really like it a lot!
    I have used other plugins like Advanced Custom Fields etc. But from time to time
    I want to use a more straight on function for certain theme specific setting etc.
    and I think your plugin really do that job excellent, Really Great! Thanks!

  • Onur Oztaskiran January 9, 2017 at 17:37

    I’m a wordpress theme designer and have already used Misha’s snippets before. Now I tried a lot of meta box plugins out there esp premium ones.

    Not one of them is near this plugin!

    Highly recommended! It will be worth your 20 bucks so many times :)

  • Onur Oztaskiran January 9, 2017 at 11:21

    Hey Misha,

    I don’t have Paypal. Is there any other way I can buy with credit card?

    Thanks!

  • Are there any undocumented helper functions that return an array that can simply be passed to the args parameter of a select or multi-select option to more easily populate options with from the following sources?

    * All Public (Custom) Post Types
    * All Taxonomies
    * All Terms (for a given Taxonomy)
    * All Posts (for a given Post Type – Page, Post, Custom)

    The saved meta value would be the ID of the selected item.

    • MishaAuthor January 5, 2017 at 20:14

      Hi,

      please, give me 1-2 days to add the mentioned functions to the new plugin version. I will notify you by email when the new version (1.2) will be available. After that you could easily update the plugin directly from your WordPress admin area.

      Thank you for suggestion.

      • Thank you for the reply!

        While I forgot the word “Public” in front Taxonomies in my previous comment, that’s what I meant.

        I figured there weren’t any such helpers but having now confirmed that, I will tell you that I just decided to write them myself yesterday to see how long it would take since I didn’t know when if ever to expect a response. It turned out to be pretty straightforward.

        All the functions I needed previously have now been written and do what I wanted. I tell you this to potentially avoid any duplication of work. These functions might even benefit from a refactor by yourself. If you’d like me to send them to you so you don’t have to start from nothing, send me an email using the one from this comment and I will reply. I don’t want to post them here. If you use them in any form in the core product, that’s fine.

        Thanks again! :-)

Leave your question or feedback

phpjsHTMLCSSSQLCode
Please, enter a comment
Please, enter a name
Incorrect email

14-Day Money Back Guarantee

Secure Checkout. Instant Download

Recommended

Advanced

$130 one-time payment
  • Lifetime priority support
  • Lifetime updates
  • Unlimited websites

Regular

$30 one-time payment
  • 2 weeks/support
  • 1 year/updates
  • Unlimited websites

View my refund policy here

The plugin is a one-time purchase which includes a license for plugin updates and support. To continue receiving updates & support after your license has expired you may renew at a discounted rate of 50%.