Opened 7 years ago
Closed 7 years ago
#36367 closed enhancement (fixed)
Give users control on the term redirect
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.6 | Priority: | normal |
Severity: | normal | Version: | 4.4.2 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
This is a copy of an existing method inside the post.php
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
Attachments (1)
Change History (16)
#4
follow-up:
↓ 11
@
7 years ago
Hi @alexvandervegt, thanks for the ticket! Would you like to add a patch?
Note that new filters need to be documented as per the documentation standards.
#5
@
7 years ago
Here you go:
<?php /** * Filter the taxonomy redirect destination URL. * * @since 4.5.0 * * @param string $location The destination URL. * @param object $tax The taxonomy object. */ wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) );
#6
@
7 years ago
@alexvandervegt Once you you update your PR with the docs changes, you can add .diff
to the end of the PR URL to get a patch to upload to this ticket.
e.g. https://patch-diff.githubusercontent.com/raw/WordPress/WordPress/pull/193.diff
#7
follow-up:
↓ 10
@
7 years ago
(You can also use https://rmccue.io/patch/ to do that for you too. :) )
#8
@
7 years ago
Here you go:
https://patch-diff.githubusercontent.com/raw/WordPress/WordPress/pull/195.diff
<?php diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index b953da6..14290e3 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -205,7 +205,15 @@ if ( ! empty( $_REQUEST['paged'] ) ) { $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); } - wp_redirect( $location ); + /** + * Filter the taxonomy redirect destination URL. + * + * @since 4.5.0 + * + * @param string $location The destination URL. + * @param object $tax The taxonomy object. + */ + wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) ); exit; }
#10
in reply to:
↑ 7
@
7 years ago
Replying to rmccue:
(You can also use https://rmccue.io/patch/ to do that for you too. :) )
This does not work, it keeps loading at the end
#11
in reply to:
↑ 4
@
7 years ago
- Severity changed from normal to blocker
Replying to SergeyBiryukov:
Hi @alexvandervegt, thanks for the ticket! Would you like to add a patch?
Note that new filters need to be documented as per the documentation standards.
The patch is supplied 2 months ago, when will this be implemented?
We are still waiting desperately for this.
#12
@
7 years ago
- Keywords has-patch added
- Severity changed from blocker to normal
@alexvandervegt I've added your patch to the ticket. Can you explain a little bit about the use-case for this filter in this specific location?
#13
@
7 years ago
Hi @DrewAPicture this is a copy of an existing method inside the post.php
<?php wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
In my case we have a custom redirect scheme so we need to check for double slugs on taxonomies, I use the existing redirect_post_location for posts and this works awesome. However there was no likewise functionality for the taxonomy part so that's where the patch comes in.
+1