• I’ve set up a simple plugin that adds custom rewrite rules to WordPress. Here is the code for that plugin: https://gist.github.com/JCPry/7324825.

    A page is created within WordPress with the slug property-detail. That page has a custom page template that allows it do so some processing of the property_id query argument.

    The problem is that the rewrite rule isn’t being recognized properly. Here’s an example URL that should be handled by the custom rewrite rules: https://mflwv1westvolu.staging.wpengine.com/property-detail/1500000005169806/. For this URL (and others like it), instead of the value 1500000005169806 being converted to the property_id query arg, it is instead recognized as a page number. WordPress then redirects to the highest-possible 32-bit page number, which is the URL https://mflwv1westvolu.staging.wpengine.com/property-detail/2147483647/.

    I have added some debugging output to the top of the page. If you use “View Source” in your browser, you can see a dump of the global $wp_query and $wp_rewrite variables. Disregard the lack of proper styling, as the page template was just copied as-is into a different theme (see below).

    What seems to be especially odd in this case is that the exact same custom rewrite rules work properly on a different installation of WordPress on the same server. Here’s a URL that does work: https://rflcw1chapmanj.wpengine.com/property-detail/1500000005169806/

    For the site that is not currently working, I have tried the following:

    1. Flushing the rewrite rules by visiting Settings > Permalinks
    2. Setting the permalink structure back to the default (non-pretty permalinks), saving, then setting the permalink structure back to %postname%, and saving again
    3. Deactivating all other plugins on the site
    4. Switching to the Twenty Thirteen theme (I copied the appropriate custom page template into the twenty thirteen theme folder)
    5. Reinstalling the WordPress core files
    6. Creating an entirely new installation of WordPress using a different database table prefix.

    Honestly, the most frustrating thing about this issue is the fact that it works just fine for another installation in the same environment, but not for this installation.

    Thanks in advance to anyone who is able to help me figure out why this isn’t working.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Just commenting so I can follow this topic.

    Thread Starter Jeremy Pry

    (@jpry)

    @ballarino Just an FYI, there is a “Subscribe to Topic” link on the right side of each forum thread that can be used to subscribe, instead of leaving a comment.

    Does anyone have any thoughts or suggestions on this issue?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Rewrites not used by WordPress’ is closed to new replies.