Execution of JavaScript on save post

Do it like shown below, as suggested by @gyo and done by @Howdy_McGee in his answer. function admin_queue( $hook ) { global $post; if ( $hook == ‘post-new.php’ || $hook == ‘post.php’ ) { if ( ‘targeted-posttype’ === $post->post_type ) { wp_enqueue_script( ‘custom-title-here’, bloginfo( ‘template_directory’ ) . ‘/scripts/custom-script.js’, ‘jquery’, ”, true ); } } } … Read more

Autosave control in WordPress

Autosave: Autosave is simply about saving your posts automatically in the background while you are editing. So it’s different from revisions and for every post there will be only one autosave per user. This is from the document: There is only ever a maximum of one autosave per user for any given post. New autosaves … Read more