I have two wordpress sites:
- running on localhost server (PHP7.3)
- hosted on Bluehost (PHP7.2)
The metabox gets added on my local website, but the same piece of code does not work on bluehosted website.
What is wrong?
add_action( 'add_meta_boxes', 'add_mu_address_meta_box' );
function add_mu_address_meta_box() {
add_meta_box(
'your_fields_meta_box', // $id
'mu Address', // $title
'show_mu_address_meta_box', // $callback
'post', // $screen
'advanced', // $context
'high' // $priority
);
}
function show_mb_address_meta_box() {
global $post;
$meta = get_post_meta( $post->ID, 'your_fields', true ); ?>
<input type="hidden" name="your_meta_box_nonce" value="<?php echo wp_create_nonce( basename(__FILE__) ); ?>">
<?php }
I have two wordpress sites:
- running on localhost server (PHP7.3)
- hosted on Bluehost (PHP7.2)
The metabox gets added on my local website, but the same piece of code does not work on bluehosted website.
What is wrong?
add_action( 'add_meta_boxes', 'add_mu_address_meta_box' );
function add_mu_address_meta_box() {
add_meta_box(
'your_fields_meta_box', // $id
'mu Address', // $title
'show_mu_address_meta_box', // $callback
'post', // $screen
'advanced', // $context
'high' // $priority
);
}
function show_mb_address_meta_box() {
global $post;
$meta = get_post_meta( $post->ID, 'your_fields', true ); ?>
<input type="hidden" name="your_meta_box_nonce" value="<?php echo wp_create_nonce( basename(__FILE__) ); ?>">
<?php }
Share
Improve this question
edited Sep 23, 2019 at 2:05
Morgan Janjua Crane
asked Jan 23, 2019 at 16:07
Morgan Janjua CraneMorgan Janjua Crane
55 bronze badges
1 Answer
Reset to default 0add_action( 'add_meta_boxes', 'add_mu_address_meta_box' );
function add_mu_address_meta_box() {
$screens = array( 'post', 'page' );
add_meta_box(
'your_fields_meta_box','mu Address','show_mb_address_meta_box',$screens,'advanced','high'
);
}