diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index 342eb528b4..b08498f9dd 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -3058,11 +3058,11 @@ function wp_media_attach_action( $parent_id, $action = 'attach' ) { $location = 'upload.php'; if ( $referer = wp_get_referer() ) { if ( false !== strpos( $referer, 'upload.php' ) ) { - $location = remove_query_arg( array( 'attached', 'detached' ), $referer ); + $location = remove_query_arg( array( 'attached', 'detach' ), $referer ); } } - $key = 'attach' === $action ? 'attached' : 'detached'; + $key = 'attach' === $action ? 'attached' : 'detach'; $location = add_query_arg( array( $key => $result ), $location ); wp_redirect( $location ); exit; diff --git a/src/wp-admin/upload.php b/src/wp-admin/upload.php index e25b887175..6e16c75ea1 100644 --- a/src/wp-admin/upload.php +++ b/src/wp-admin/upload.php @@ -225,12 +225,12 @@ if ( ! empty( $_GET['posted'] ) ) { if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) { $message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached ); - $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detached', 'attached' ), $_SERVER['REQUEST_URI'] ); + $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); } -if ( ! empty( $_GET['detached'] ) && $detached = absint( $_GET['detached'] ) ) { +if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) { $message = sprintf( _n( 'Detached %d attachment.', 'Detached %d attachments.', $detached ), $detached ); - $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detached', 'attached' ), $_SERVER['REQUEST_URI'] ); + $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); } if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {