Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#38194 closed defect (bug) (fixed)

Term order and current page is lost when bulk deleting terms

Reported by: ocean90's profile ocean90 Owned by: ocean90's profile ocean90
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch
Focuses: administration Cc:

Description

Steps to reproduce:

  • Go to wp-admin/edit-tags.php
  • Order terms by count
  • Go to the last page
  • Bulk delete two terms

Expected: You stay on the same page with the same ordering (/edit-tags.php?taxonomy=post_tag&orderby=count&order=asc&paged=71&message=6)
Actual: You get redirected to the index page. (/edit-tags.php?taxonomy=post_tag&message=6&paged=1)

Attachments (1)

38194.patch (3.5 KB) - added by ocean90 8 years ago.

Download all attachments as: .zip

Change History (5)

@ocean90
8 years ago

#1 @ocean90
8 years ago

38194.patch:

  • Removes special handling for edit-tags.php which is no longer required because of term.php. Related: [34202], [36308]
  • Sets $referer to $_SERVER['REQUEST_URI'] because wp_get_referer() returns false if $_SERVER['REQUEST_URI'] === $_REQUEST['_wp_http_referer'].
  • Sets paged always to $pagenum which is the value of $wp_list_table->get_pagenum();. This avoids an additional redirect when you delete an item which was previously on the last page.

@swissspidy Since you introduced term.php, how does 38194.patch look to you?

Semi-related: #37573

#2 @swissspidy
8 years ago

WIthout the patch applied, I now followed the steps to reproduce.

Being on edit-tags.php?taxonomy=post_tag&orderby=count&order=asc&paged=4 (the last page), I bulk delete two terms. After that, I'm still on edit-tags.php?taxonomy=post_tag&paged=4, but the order is lost.

With the patch applied, I'm on the same page as well, but the order is kept. Even when editing a term and going back afterwards.

Looking at the code, the patch does indeed look good to me. No objections.

#3 @ocean90
8 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 38750:

Taxonomy: Don't drop term order and current page when bulk deleting terms.

  • Removes special handling for edit-tags.php which is no longer required because of term.php. Related: [34202] and [36308].
  • Sets $referer to $_SERVER['REQUEST_URI'] because wp_get_referer() returns false if $_SERVER['REQUEST_URI'] === $_REQUEST['_wp_http_referer'].
  • Sets paged always to $pagenum which is the value of $wp_list_table->get_pagenum();. This avoids an additional redirect when you delete an item which was previously on the last page.

Fixes #38194.

#4 @ocean90
8 years ago

In 38752:

Taxonomy: Remove paged argument from referer and add it only if current page is greater than 1.

Props swissspidy.
See #38194.

Note: See TracTickets for help on using tickets.