Sunday, May 19, 2024
HomeWordPress Developmentpermalinks - Customized submit sort posts auto redirects me to rewritten URLs

permalinks – Customized submit sort posts auto redirects me to rewritten URLs


I’ve a customized submit sort named motion pictures and in archive-movies.php (pattern.com/motion pictures/) I am displaying a listing or checklist of flicks and it has the alphabetical pagination, With a purpose to obtain that I used add_rewrite_rule() here is my code beneath.

add_rewrite_rule(
  "^motion pictures/([a-z])/?",
  "index.php?taxonomy=movies_alphabet&time period=$matches[1]",
  "high"
);

And now that I’ve efficiently rewrote urls with it, everytime I go to a submit from my customized submit sort motion pictures it redirects me to the alphabetical pagination. Pattern state of affairs beneath

  • pattern.com/motion pictures/aquaman redirects to pattern.com/motion pictures/a
  • pattern.com/motion pictures/bumblebee redirects to pattern.com/motion pictures/b
  • pattern.com/motion pictures/interstellar redirects to pattern.com/motion pictures/i

I’ve tried placing this code beneath to my features.php and nonetheless did not repair the difficulty.

add_filter('do_redirect_guess_404_permalink', '__return_false'); 

operate remove_redirect_guess_404_permalink( $redirect_url ) {
    if ( is_404() ) {
        return false;
    }
    return $redirect_url;
}
add_filter( 'redirect_canonical', 'remove_redirect_guess_404_permalink' );

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments