ID, 'ap_cpt_author_position', true ); $ap_cpt_author_company = get_post_meta( $post->ID, 'ap_cpt_author_company', true ); ?>

ID, 'ap_cpt_author_position', true ); $stz_author_position = sanitize_text_field($_POST['ap_cpt_author_position']); $ap_cpt_author_company = get_post_meta( $post->ID, 'ap_cpt_author_company', true ); $stz_author_company = sanitize_text_field($_POST['ap_cpt_author_company']); //update author's position if ( $stz_author_position && '' == $stz_author_position ){ add_post_meta( $post_id, 'ap_cpt_author_position', $stz_author_position ); }elseif ($stz_author_position && $stz_author_position != $ap_cpt_author_position) { update_post_meta($post_id, 'ap_cpt_author_position', $stz_author_position); } elseif ('' == $stz_author_position && $ap_cpt_author_position) { delete_post_meta($post_id,'ap_cpt_author_position', $ap_cpt_author_position); } //update author's company if ( $stz_author_company && '' == $stz_author_company ){ add_post_meta( $post_id, 'ap_cpt_author_company', $stz_author_company ); }elseif ($stz_author_company && $stz_author_company != $ap_cpt_author_company) { update_post_meta($post_id, 'ap_cpt_author_company', $stz_author_company); } elseif ('' == $stz_author_company && $ap_cpt_author_company) { delete_post_meta($post_id,'ap_cpt_author_company', $ap_cpt_author_company); } } add_action('save_post', 'ap_cpt_testimonials_info_save_post');