Opened 6 years ago
Closed 6 years ago
#47858 closed defect (bug) (fixed)
Incorrect redirect after deleting a term from a taxonomy of a custom post type
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.3 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Taxonomy | Keywords: | has-patch |
| Focuses: | administration | Cc: |
Description
Given a taxonomy attached to a custom post type, deleting a term from the individual term editing screen redirects the user to the term listing screen without the post_type query var, which is incorrect and means the Posts menu is highlighted.
Steps to reproduce on a site with a taxonomy attached to a custom post type:
- Navigate to the term listing screen for the taxonomy
- Click the
Editlink below a term - Click the
Deletelink at the bottom of the screen and confirm the prompt
Observe that the URL you're redirected to is missing the post_type query var and that the Posts admin menu is highlighted.
Attachments (2)
Change History (8)
#2
@
6 years ago
- Milestone changed from Awaiting Review to 5.3
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
#3
@
6 years ago
Updated patch 47858.2.diff with different code change.
@SergeyBiryukov, @donmhico Can you please check it.
#4
@
6 years ago
@mukesh27 IMHO
if ( 'post' !== get_current_screen()->post_type )
is better than
if ( ! empty( $typenow ) )
because the former is easier to understand.
#5
@
6 years ago
@donmhico As per $taxnow variable we can access $typenow from parent code.
Check https://github.com/WordPress/WordPress/blob/master/wp-admin/term.php#L15
Nice find @johnbillion. I can't believe we've missed this up until now.
In my attached patch, 47858.diff, you'll notice that I removed
esc_url()inwp_redirect( $sendback );This is because
esc_url()will transform&to&which is not what we wanted in our url query args. Also, the base url is defined as$sendback = admin_url( 'edit-tags.php' );and the url query args are added usingadd_query_arg()so I think it's safe to remove theesc_url().