I am developing a wp plugin which supports custom post type in that i have create a metabox everything goes well.When i enter the values in my metabox field it will not display in admin panel where as it will store in database(wp_postmeta table ).Can any one suggest me what is going wrong with my code.
//Create Meta box
function astest_add_metabox(){
add_meta_box("astestimonial_metaboxes", "AS-Testimonial Client Information", "astestimonial_meta_box", "astestimonial", "side", "low");
}
add_action('add_meta_boxes','astest_add_metabox');
//html code
function astestimonial_meta_box($post_id){
wp_nonce_field('astest_meta_box','astest_meta_box_nonce');
$clientname = get_post_meta($post->ID,'clientname_value','true');
echo'<label for="client_name_val">';
_e('Name: ', 'astestimonial_textdomain');
echo'</label>';
echo'<input type="text" id="clientname_value" name="clientname_value" value="'.esc_attr($clientname).'" />';
//save post
function as_testi_save_data($post_id){
global $post;
if(isset($_POST['post_type']) && ($_POST['post_type'] == "astestimonial"))
{
$cli_name_data = $_POST['clientname_value'];
update_post_meta($post_id, 'clientname_value', $cli_name_data);
}
}
add_action("save_post", "as_testi_save_data");
Can anyone find what is wrong with this.. Thanks