Skip to content

Instantly share code, notes, and snippets.

@kachi
Last active August 29, 2015 13:56
Show Gist options
  • Save kachi/9043502 to your computer and use it in GitHub Desktop.
Save kachi/9043502 to your computer and use it in GitHub Desktop.
記事公開前にアラートを出す
$c_message = '記事を公開します。宜しいでしょうか?';
function confirm_publish(){
// JavaScriptを管理画面フッターに挿入する
global $c_message;
echo '<script type="text/javascript"><!--
var publish = document.getElementById("publish");
if (publish !== null) publish.onclick = function(){
return confirm("'.$c_message.'");
};
// --></script>';
}
add_action('admin_footer', 'confirm_publish');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment