If you want a custom admin page for a taxonomy, you can set 'show_ui' => false
when you register it to suppress the default admin page and then create a new admin page to replace it.
However edit-tags.php?taxonomy=taxonomy-slug
still takes you to the ‘hidden’ default admin page. Is there way of directing it instead to the custom admin page. Or otherwise is there another method than circumvents this issue?
Not sure why I didn’t think of this earlier. I suppose I was hoping for a way to ‘hijack’ the default page to display something else… Anyway following my original method:
You can get round the issue of
edit-tags.php?taxonomy=taxonomy-slug
taking you to the hidden taxonomy page, by simply redirecting the user to your page, usingwp_redirect
:Assuming
mytax
is the taxonomy name.$url
should be the url of the custom page replacing the default taxonomy page.Do a simple redirect:
I tried to take the whole pages thing apart and wrote a table to sum them up and get definitive hints about where you currently are in this paste.
To list them here:
global $menu
→ not possibleglobal $submenu
→ slugedit-tags.php?taxonomy=YOUR_TAX
global $current_screen
→ idedit-YOUR_TAX
1)global $self
→edit-tags.php
1) 2)$GLOBALS['$_SERVER']['REQUEST_URI']
→edit-tags.php?taxonomy=YOUR_TAX
1)1) Be sure to also check…
if ( edit.php?post_type=YOUR_CPT === $GLOBALS['current_screen']['parent_file'] )
…in case your tax is registered elsewhere too.
2) This will only help if a) you’re that you ain’t got another tax registered or b) if you want to redirect them all.