I am able to redirect the user back to the edit.php admin page after they have successfully created/updated a post.
However, is it possible to redirect them to the taxonomy term posts page? This way, when a user creates a post, they will be redirected to the admin post list page that only shows that post and others with the same taxonomy term.
Any help is appreciated. Thanks!
First of all note that a post can have more than one category, also posts can have no category, what you’ll do in that cases?
And what about post update?
That said, if you look at the url when in
edit.php
and select a category by clicking on its name, you’ll notice that the only thing that change in the url is that the paramcategory_name
is appended to url.You can easily do that by get the category using
get_the_category
and appending the url argument usingadd_query_arg
.I’m assuming that:
edit.php
without any category filter.So:
I’ve used
'wp_insert_post'
with the highest priority because it’s the last hook fired when a post is saved. In this way code for saving custom metaboxes, that normally runs onsave_post
, should work with no problems because that hook is fired first.However, the issues with this are:
edit.php
the filter is not very evident at first glance and this can confuse usersFor these reasons, I want to share a way to proper show messages making the edit page more clear after redirect: