WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed that if you go to lostlettermen.com/aa, it redirects to a post. Is this a feature in WordPress that can be turned off, or is this done by some type of plugin or custom code?

share|improve this question

migrated from stackoverflow.com May 24 '11 at 12:09

This question came from our site for professional and enthusiast programmers.

custom code query – xLRDxREVENGEx May 24 '11 at 15:41

This is done by redirect_guess_404_permalink(), which is called from redirect_canonical(). redirect_canonical() does more than just this: it makes sure you are always using a single canonical URL for an item, it will add slashes, force the same domain name, ...

You can either unhook redirect_canoncial so it does nothing, or you can hook into it and prevent redirection when it is a 404:

// Disable redirect_canonical()
add_action( 'init', 'wpse18110_init' );
function wpse18110_init()
    remove_action( 'template_redirect', 'redirect_canonical' );

// Only prevent redirect on 404
add_filter( 'redirect_canonical', 'wpse18110_redirect_canonical' );
function wpse18110_redirect_canonical( $redirect_url )
    if ( is_404() ) {
        return false;
    return $redirect_url;
share|improve this answer
nice! didn't know about the redirect_guess_404_permalink() – MZAweb May 27 '11 at 19:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.