skip to Main Content

Any pages with page type posts, order type posts, or posts show this error. This is only visible on a hosted environment. I cannot replicate the errors locally

I have done the following in this order:

  1. deactivated all plugins
  2. went to settings->permalinks and resaved the %postname% option
  3. verified that error is still present with no plugins and permalinks reset.
  4. Updated all plugins and themes.
  5. Verified error is still present.
  6. Followed the same procedure locally, and was not able to replicate this problem.

from class-wp.php:

foreach ( (array) $rewrite as $match => $query ) {
    // If the requested file is the anchor of the match, prepend it to the path info.
    if ( ! empty( $requested_file ) && strpos( $match, $requested_file ) === 0 && $requested_file != $requested_path ) {
        $request_match = $requested_file . '/' . $requested_path;
    }

    if ( preg_match( "#^$match#", $request_match, $matches ) ||
        preg_match( "#^$match#", urldecode( $request_match ), $matches ) ) {

        if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=$matches[([0-9]+)]/', $query, $varmatch ) ) {
            // This is a verbose page match, let's check to be sure about it.
            $page = get_page_by_path( $matches[ $varmatch[1] ] );
            if ( ! $page ) {
                continue;
            }

            $post_status_obj = get_post_status_object( $page->post_status );
            if ( ! $post_status_obj->public && ! $post_status_obj->protected
                && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) {
                continue;
            }
        }

        // Got a match.
        $this->matched_rule = $match;
        break;
    }
}

I have scoured the interweb for an answer on this, but I have come up with nothing. Let the WordPress Junkies speak please.

3

Answers


  1. Chosen as BEST ANSWER

    Thank you for your help everyone. This ended up being a conflict with a plugin called The Events Calendar. If you create a page with the name Events, and change The Events Calendar default page of "events" to something else this error occurs. Since it's a third party app, I am just going to look for something else to suit my needs. By removing the folder completely from the plugins directory, the error is cleared.


  2. Change the Permalink Settings

    In your WordPress site, under settings -> If Permalink setting is Post Name try changing it to Custom Structure and vice versa.
    This helped me in fixing this error.

    enter image description here

    Login or Signup to reply.
  3. I had the same error on alle pages, except the homepage. When I changed Permalinks from "Postname" to "Simple" (pageid) error was gone. When I switched back, error was back too.
    Finally I tried to add a slash to the end of the base URL in Settings -> General -> "WordPress address (URL)" & "Siteaddress (URL)".
    After saving settings the slash was gone (because it is not valid to have it) but the problem was solved too.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search