[wp-trac] [WordPress Trac] #44849: Post type parameter not preserved when editing/deleting custom taxonomy term

WordPress Trac noreply at wordpress.org
Tue Sep 4 16:51:30 UTC 2018


#44849: Post type parameter not preserved when editing/deleting custom taxonomy
term
--------------------------+------------------------------
 Reporter:  wallfur       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  4.9.8
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration
--------------------------+------------------------------
Changes (by wallfur):

 * severity:  minor => normal


Comment:

 I left the hidden input in the form, which ensures the link shown after
 saving a change goes back to the correct terms page.

 I have worked around the context loss from the delete link on that page by
 passing the referrer along to the link. This also reinstated the "Item
 deleted" message, so I'm fairly sure it's a genuine bug.

 {{{#!php
 add_filter(
         'admin_url'
         , function($url) {
                 if (empty($_REQUEST['wp_http_referer'])) {
                         return $url;
                 }
                 return preg_replace(
                         '#^[^?]+/edit-
 tags\\.php\\?action=delete&(amp;)?taxonomy=CUSTOMTAX(?:&.*)?$#'
                         , '$0&${1}_wp_http_referer=' .
 rawurlencode(stripslashes($_REQUEST['wp_http_referer']))
                         , $url
                 );
         }
 );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44849#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list