I want to move a post in trash but the condition is that simultaneously I need to delete some more posts. Sample Code:

jQuery(function($) {
    $('#delete-action a').unbind();
    $('#delete-action a').click(function(event) {
    openbox('Trash Child Posts', 1);
            function() {
                $('#save-action .spinner').hide();

It pop ups a new popup to delete the child post.

    var trash_blog = $('div#trash-button');
$("#trash-button").click( function()
        var allVals = [];
        $('div#box :checked').each(function() {


Now the problem: How to bypass the nonce value when window.location executes?
After redirection it says 'Are you Sure to do this, Please try again' because nonce value doesn't match.

  • Show how you add the nonce and how you check it. The problem isn't your javascript code.
    – kaiser
    Commented Apr 30, 2013 at 12:22
  • Still I am not creating the nonce. I want to ask how can we do that so I can pass nonce through java script.
    – Xing Lee
    Commented Apr 30, 2013 at 12:53
  • See WordPress Nonces -> Related in Codex
    – kaiser
    Commented Apr 30, 2013 at 13:34
  • Вo you need additional deletion logic to run in JS? Why not implement it on PHP level, using hooks?
    – Rarst
    Commented Apr 30, 2013 at 16:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.