I have some custom JavaScript on the admin side, on for counting the posts, the other for checking if a checkbox have been ticked.
$('.inside input').on('click', function() {
if ($(this).is(':checked')) {
console.log('checked');
$('#title').val('overview');
} else {
$('#title').val(title);
}
});
the other one
$('#postexcerpt').find('textarea').on('keyup', function(e) {
max_chars = 240 - $(this).val().length;
if (max_chars < 1) {
$(this).val($(this).val().substr(0,238));
}
$('#counterbox').html(max_chars);
});
The codes above are working. My problem is when I save the post, CPT or any other post type the Title field does not get saved? Any ideas on this?
Update - Saving CPT
add_action('save_post','save_press_meta');
function save_press_meta() { global $post; $post_id = $post->ID;
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if( isset( $_POST['paper'] ) )
update_post_meta( $post_id, 'paper',$_POST['paper']);
if( isset( $_POST['press_article_thumbnail'] ) )
update_post_meta( $post_id, 'articlethumbnail',$_POST['press_article_thumbnail']);
if( isset( $_POST['press_article_content'] ) )
update_post_meta( $post_id, 'articlecontent',$_POST['press_article_content']);
if( isset( $_POST['press_article_pubtime'] ) )
update_post_meta( $post_id, 'articlepubtime',$_POST['press_article_pubtime']);
}
.inside
, this class is used by WordPress as well for publish button wrapper, your js will conflict. See if you are getting some js error in console