Created
May 8, 2018 07:55
-
-
Save ksuzushima/5aee24be50ecda154f017e5dd49266a9 to your computer and use it in GitHub Desktop.
Basic usage for add_meta_box #wordpress #add_meta_box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Basic usage add_meta_box | |
* @link https://developer.wordpress.org/reference/functions/add_meta_box/ | |
*/ | |
add_action( 'add_meta_boxes', 'add_custom_meta_box' ); | |
/** | |
* Add custom meta box | |
*/ | |
public function add_custom_meta_box() { | |
add_meta_box( | |
'meta_box_id', // id | |
'Meta box title', // title | |
'show_custom_meta_box', // callback | |
'post', // post_type | |
'side', // context | |
'high' // priority | |
); | |
} | |
/** | |
* Custom meta box collback function | |
*/ | |
public function show_custom_meta_box() { | |
echo 'Here, your meta box content.'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment