Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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'); |
Screen shot
Note
Description | 記事を公開する前に確認の旨のアラートを出す事で、誤クリック等による公開ミスを防げるようにします。 |
---|---|
WordPress Ver. | 3.8.1 |
Via | How to Avoid Accidental Publishing |