I want to open javascript message “Are you sure you want to move the post to trash?”when we clicks on “Move to Trash” link in Publish box.
and when we click to OK the post go to trash or cancel to go back to the post.
I found this code on previous question. It’s open the javascript message but when I click OK it’s just close the popup and don’t move the post to trash. What can I add to fix it?
CODE :
if (! empty($GLOBALS['pagenow']) && 'post.php' === $GLOBALS['pagenow'])
add_action('admin_footer', 'trash_click_message');
function trash_click_message() {
echo <<<JQUERY
<script>
jQuery(function($) {
$('#delete-action a').unbind();
$('#delete-action a').click(function(event) {
event.preventDefault();
alert('Are you sure you want to move the post to trash?');
setTimeout(
function() {
$('#save-action .spinner').hide();
$('#publish').removeClass('button-primary-disabled');
},
1
);
});
});
</script>
JQUERY;
}
Picture of my actuel result
UPDATE :
Thanks bergire! It’s all most done. I just have one issues. I use WordPress in english but the serveur is on France. So the confirmation popup is in french like you see in the picture.
Is it a way to change labels to (indique) and (annuler) words?