permalinks – Custom post type posts auto redirects me to rewritten URLs


I have a custom post type named movies and in archive-movies.php ( I’m displaying a directory or list of movies and it has the alphabetical pagination, the alphabetical pagination is achieved by creating a custom taxonomy movies_alphabet under my custom post type movies.

In order to achieve that I used add_rewrite_rule() to rewrote url of my custom taxonomy from to here’s my code below.


And now that I’ve successfully rewrote urls with it, everytime I visit a post from my custom post type movies it redirects me to the alphabetical pagination. Sample scenario below

  • redirects to
  • redirects to
  • redirects to

I’ve tried putting this code below to my functions.php and still didn’t fix the issue.

add_filter('do_redirect_guess_404_permalink', '__return_false'); 

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

agent abstract 2 months 2023-02-02T22:36:24-05:00 0 Answers 0 views 0

Leave an answer