[wp-trac] [WordPress Trac] #44849: Post type parameter not preserved when editing/deleting custom taxonomy term
WordPress Trac
noreply at wordpress.org
Mon Aug 27 15:54:23 UTC 2018
#44849: Post type parameter not preserved when editing/deleting custom taxonomy
term
----------------------------+-----------------------------
Reporter: wallfur | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 4.9.8
Severity: minor | Keywords:
Focuses: |
----------------------------+-----------------------------
I get linked or redirected back to the Posts area in the admin menu after
editing or deleting a custom taxonomy rather to the custom post type for
which I registered the taxonomy.
Steps:
1. Plugin registers custom post type then custom taxonomy
1. Visit custom taxonomy page via automatically generated link in admin
menu: https://foo.example/wp-admin/edit-
tags.php?taxonomy=CUSTOMTAX&post_type=CUSTOMPOST (custom post type section
of admin menu is highlighted and open)
1. Add a term (term is added to the table at right)
1. Click term's name to open full edit page; delete link and form have no
reference to the `post_type` that is in the URL of the current edit page.
1. Editing/deleting the term works, but afterwards I'm back at the terms
list page in the context of Posts, not my custom post type.
I can maintain the context, when editing, with this code:
{{{
add_action(
CUSTOMTAX . '_term_edit_form_top'
, function() {
?><input type=hidden name=post_type value=<?= CUSTOMPOST ?>><?php
}
);
}}}
I tried correcting the delete URL, and it got the parameter but the final
redirect was missing it, thus the Posts submenu was open again:
{{{
add_filter(
'admin_url'
, function($url) {
return preg_replace(
'#/edit-tags\\.php\\?action=delete&(?:amp;)?taxonomy='.
CUSTOMTAX . '(?=&)#'
, '$0&post_type=' . CUSTOMPOST
, $url
);
}
);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44849>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list