Bypass nonce value while trashing a post

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) {
        event.preventDefault();
    openbox('Trash Child Posts', 1);
        setTimeout(
            function() {
                $('#save-action .spinner').hide();
                $('#publish').removeClass('button-primary-disabled');
            },
            1
        );
    });
});

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

Read More
    var trash_blog = $('div#trash-button');
$("#trash-button").click( function()
       {
         TrashBlogs.each(function(){
        var allVals = [];
        $('div#box :checked').each(function() {
          allVals.push($(this).val());
        });

        window.location.replace("post.php?post="+post_id
            +"&action=trash&_wpnonce=20a76fd1e5&blog_id="+allVals);
    });
       }
    );`

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.

Related posts

Leave a Reply