• Resolved charlietriplett

    (@charlietriplett)


    I’m having a sudden permalinks issue that Google and I can’ seem to solve.

    My permalink settings are: /%year%/%monthnum%/%postname%/

    When visiting a post like /2013/03/hard-work-pays-off-with-great-job-offer/, the page resolves on the /2013/03/ monthly archive.

    When permalink setttings are /%year%/%postname%/ things work normally, however, I prefer /%year%/%monthnum%/%postname%/

    Network Admin permalink settings:
    /wp-admin/network/site-settings.php?id=1
    /%year%/%monthnum%/%postname%/

    Example on our duplicate development site
    http://engineering-redesign.missouri.edu/2013/03/hard-work-pays-off-with-great-job-offer/

    I’ve already tried:
    reset the permalinks at /wp-admin/options-permalink.php
    emptied wp_options rewrite_rules
    reduced my .htaccess to bare minimum rules

    I’ve been using this WordPress site for 2 years, and have not come across this before. Stumped.

    For the time being, our live site: http://engineering.missouri.edu/2013/hard-work-pays-off-with-great-job-offer/ is set to /%year%/%postname%/ and is working normally.

    Thoughts?

Viewing 8 replies - 1 through 8 (of 8 total)
  • It’s hard to troubleshoot the problem without knowing what all your rewrite rules are. For rewrite debugging I use the Rewrite rules Inspector plugin. Install and activate the plugin then go to the inspector under the tools menu. In the search box paste in on of the /%year%/%monthnum%/%postname%/ urls you mentioned and it will give you the rule that this is matching.

    You can also deactivate all your plugins and switch to the default theme, twentytwelve then flush your rules and see if the problem exists then go through and activate your plugins one by one to find out the culprit.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    What’s in your .htaccess? Any weird httpd.conf rules?

    Thread Starter charlietriplett

    (@charlietriplett)

    @ Ipstenu
    Nothing weird in .httaccess or htttpd.conf.

    For the development/testing site, it’s the default network rules:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    Thread Starter charlietriplett

    (@charlietriplett)

    @ Chris Olbekson
    Okay, I 1) switched to TwentyTwelve,
    2) flushed rules using the Rewrite Rules plugin β€” posts begin working fine with year/monthnum/postname permalinks.
    3) Switch back to my custom themee, posts continue to work as expected.

    Hurray!

    BUT

    Then custom post types, like /person/ are 404s.

    Normally, I just go reset the permalinks (make sure that /blog/ isn’t in network permalink settings. That typically fixes that, and it does, but then the original post permalink problem reappears.

    When I give the Rewrite Rules plugin a post, this is what it’s telling me:
    Example:
    http://engineering-redesign.missouri.edu/2013/01/new-study-rooms-allow-quiet-group-gatherings/

    Rule
    ([0-9]{4})/([0-9]{1,2})/([^/]+)/?$
    Rewrite
    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]
    Source
    date

    Rule
    ([0-9]{4})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$
    Rewrite
    index.php?year=$matches[1]&monthnum=$matches[2]&name=$matches[3]&page=$matches[4]
    Source
    post

    Rule
    (.?.+?)(/[0-9]+)?/?$
    Rewrite
    index.php?pagename=$matches[1]&page=$matches[2]
    Source
    page

    Thread Starter charlietriplett

    (@charlietriplett)

    This looks like a lead:
    Using this script:
    http://www.dev4press.com/2012/tutorials/wordpress/practical/debug-wordpress-rewrite-rules-matching/

    I see this:

    <!– Request: 2013/03/hard-work-pays-off-with-great-job-offer –>
    <!– Matched Rewrite Rule: ([0-9]{4})/([0-9]{1,2})/([^/]+)/?$ –>
    <!– Matched Rewrite Query: year=2013&monthnum=03&day=hard-work-pays-off-with-great-job-offer –>
    <!– Loaded Template: archive.php –>

    day instead of postname.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    Do CPTs work on the default theme? It sounds like they’re set up wrong in the code.

    Thread Starter charlietriplett

    (@charlietriplett)

    No, the custom posts types don’t work with the default theme. They’re written into the functions.php file β€” not plugins.

    Thread Starter charlietriplett

    (@charlietriplett)

    Yes! I found the problem.

    I had a conflict with a taxonomy slug.

    I am kicking myself right now β€” I named a taxonomy “day”.

    Thank you for the help everyone.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘year monthnum permalinks bug?’ is closed to new replies.