You can hook into the post footer actions (based on this answer, not tested):
add_action( 'admin_footer-post-new.php', 'wpse_80215_script' );
add_action( 'admin_footer-post.php', 'wpse_80215_script' );
function wpse_80215_script()
{
if ( 'post' !== $GLOBALS['post_type'] )
return;
?>
<script>
document.getElementById("publish").onclick = function() {
if ( confirm( "Ready?" ) )
return true;
return false;
}</script>
<?php
}
These actions are called in wp-admin/admin-footer.php
:
do_action( "admin_footer-" . $GLOBALS['hook_suffix'] );
This code can be used in a plugin (preferred) or in your theme’s functions.php
.
See also: