WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How could I change the redirect location after a user trashes a page? Right now they go to all pages here:....wp-admin/edit.php?post_type=page

I want them to go here:......wp-admin/edit.php?post_type=page&page=custom_page_order

share|improve this question

Hook into load-{screen_id} and check if the $_GET['trashed'] variable is 1 or above.

function wpse_trashed_redirect(){
    $screen = get_current_screen();
    if('edit-page' == $screen->id){
        if( isset($_GET['trashed']) &&  intval($_GET['trashed']) >0){
            $redirect = add_query_arg(array('page'=>'custom_page_oder', 'trashed' => false, 'ids' => false ));

This works - and I'm not aware of a better way of doing this...

share|improve this answer
I think this is close. I get this url:/wp-admin/edit.php?post_type=page&trashed=1&ids=112&page=custom_page_oder It needs to be: wp-admin/edit.php?post_type=page&page=custom_page_order – Shae May 22 '12 at 20:08
I can't get it to remove the trash id from the URL? Any ideas? – Shae May 24 '12 at 12:24
I just edited the answer to make it remove ids and trash variable from the redirected url – Shazzad Dec 11 '13 at 16:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.