add Meta box to wordpress admin

How to add Meta box to wordpress admin post page

This article will tell you about, How to add Meta box to wordpress admin post and page.Use following code and create wordpressapi.php file and upload this file to wp-content/plugins/ folder.


<?php
/*
Plugin Name:  WordPressapi Meta Box
Plugin URI: http://images.purabtech.in/
Description: Adding the Meta box to admin panel -> post
Version: 0.0
Author: WordPressapi
Author URI: http://images.purabtech.in/
*/

function wordpressapi_meta_box() {
add_meta_box(
'wordpressapi',
'Wordpressapi Box', //Meta box title
'write_in_meta_box',
'post' // You can define here where to add the Meta box(post, page, link)
);
}

function write_in_meta_box(){
echo "Wordpressapi is writing something in admin meta box";
}

if (is_admin())
add_action('admin_menu', 'wordpressapi_meta_box');
?>
add Meta box to wordpress admin
add Meta box to wordpress admin

Go to your Plugin tab and activate the “WordPressapi Meta Box” plugin.
After activating the plugin you are able to see the Meta box on post page.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

One thought on “How to add Meta box to wordpress admin post page”

Leave a Reply

Your email address will not be published.