'Or' in the post title causes 404 (8 posts)

  1. sam_m
    Posted 6 years ago #


    I have come across a very strange bug/problem, using WP 2.9.1.

    If I use 'or' in the title, for example, 'The Man or Woman', 'Is it a boy or girl?'

    After publishing the post, the post is reported as not found (404). As soon as I take 'or' out of the title of the post, it works.

    Can someone please help me and tell me why this is happening? It seems like a fundamental problem that needs to be addressed.

    I have refreshed my permalinks to in case that was causing it. But it sitll happens.

  2. bluehz
    Posted 6 years ago #

    Sheeesh - I have this exact same problem. I tracked it down to something to do with the SQL query - the "or" text is being turned into a LOGICAL OR instead of the text "or" and thats breaking the query. I just don't know how to fix it. I hope someone can help.

    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2010' AND MONTH(wp_posts.post_date)='2' AND wp_posts.post_name = 'man- OR-woman' AND wp_posts.post_type = 'post' ORDER BY wp_posts.post_date DESC

  3. bluehz
    Posted 6 years ago #

    [SOLVED] At least for me I tracked the problem down to the Search Everything plugin.

    Try disabling all plugins and I bet the issue willgo away - add the plugins back in a few at a time until you locate the problem

  4. Robert Chapin
    Posted 6 years ago #

    The bold text above would not be treated as a logical operation inside of a string literal value. It looks to me like your plugin is adding a space before the word "or", and then it can't find a matching slug with a space.

    You should also take note of the author's statement that Search Everything is only compatible up to WordPress version 2.8.5.

  5. redgoose
    Posted 6 years ago #

    haha omg, just discovered this bug today. what a pain to figure out. the problem defintely lies with search everything as when i disable it, the problem goes away.

    i'm running 2.7.1 so there goes the compatibility arguement.

  6. redgoose
    Posted 6 years ago #

    oh and it's only when there's an "-or-" in the permalink, not the title.

  7. redgoose
    Posted 6 years ago #


    in search-everything.php, function se_search_authors

    move line: $where = preg_replace("/\bor\b/i",$or." OR",$where,1);

    into the if block above it, so you end up with:

    if (!empty($wp_query->query_vars['s']))
    $or = " OR (u.user_nicename LIKE '%" . $wpdb->escape($wp_query->query_vars['s']) . "%') ";
    $where = preg_replace("/\bor\b/i",$or." OR",$where,1);

  8. dmeitz1
    Posted 6 years ago #

    My website comes up fine but when I hit the login hyper-text button I get the following error. I can't get into it to create more post.

    Thanks, Dale

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@gogreengocamping.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Thanks, Dale

Topic Closed

This topic has been closed to new replies.

About this Topic