WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#21020 closed defect (bug)

Use of $walk_dirs for post permastructure is relied upon — at Version 10

Reported by: taropaa Owned by:
Milestone: 3.4.1 Priority: normal
Severity: major Version: 3.4
Component: Rewrite Rules Keywords: has-patch needs-testing
Focuses: Cc:

Description (last modified by duck_)

[19737] for #19876 changed the $walk_dirs parameter in the generate_rewrite_rules() call for posts to be false. Although it fixes some bugs this behaviour was relied upon by some users.

Please take a look at this (in the wordpress forums) for more info: http://wordpress.org/support/topic/permalink-structure-no-longer-works/page/2?replies=38#post-2911028

Change History (11)

comment:1 @ocean903 years ago

  • Version set to 3.4

I can confirm this.

Permalink setting: /%post_id%/%postname%/

In 3.3 you could also use domain.com/%post_id%/ which shows the same post as with domain.com/%post_id%/%postname%/. But it doesn't did a redirect.

In 3.4 domain.com/%post_id%/ throws 404.

IMO domain.com/%post_id%/ should redirect too domain.com/%post_id%/%postname%/.

comment:2 @ocean903 years ago

  • Description modified (diff)

comment:3 @knutsp3 years ago

The default permalink structure is /?p=123. Do you mean that this does not work, returning a status 404?

@ocean90: When the permalink setting is /%post_id%/%postname%/ I would say that /123/ should give a 404, even when there is a post_id = 123. But it should honour /?p=123 correctly, as this is the deafult, using query parameter p.

comment:4 @ericlewis3 years ago

  • Keywords dev-feedback added

This is a result of r19737, which was related to #19876.

@duck_3 years ago

comment:5 @duck_3 years ago

The summary/description of this ticket doesn't seem to match up with the problem described in the post on the forums (and reiterated in ocean90's comment above).

Although the usage of $walk_dirs = true is accidental behaviour and creates some bugs (see #19876) I guess we might have to revert for 3.4.1 and come up with a fix for the problems described by #19876 in 3.5. Though that would mean re-breaking something that was fixed in 3.4.

The old behaviour can be restored with a filter:

add_filter('post_rewrite_rules', function ($rules) {
    return $GLOBALS['wp_rewrite']->generate_rewrite_rules($GLOBALS['wp_rewrite']->permalink_structure, EP_PERMALINK, false);
});

21020.hotfix.diff is a patch for the hotfix plugin which uses the above filter, but it doesn't do any automatic flushing of rewrite rules.

comment:6 @nacin3 years ago

  • Milestone changed from Awaiting Review to 3.4.1

comment:7 follow-up: @ocean903 years ago

  • Keywords reporter-feedback added; dev-feedback removed

The summary/description of this ticket doesn't seem to match up with the problem described in the post on the forums (and reiterated in ocean90's comment above).

I just taked a look on the linked post. So, taropaa?

comment:8 in reply to: ↑ 7 @taropaa3 years ago

Replying to ocean90:

The summary/description of this ticket doesn't seem to match up with the problem described in the post on the forums (and reiterated in ocean90's comment above).

I just taked a look on the linked post. So, taropaa?

Hi Dominik,

Maybe my description was a little off. In order to clarify, I had a custom post type which paginates. In order to link directly to a page I would pass the parameter page=2 via an URL query to the page and it would work.

the url would look like: website.com/menu/?page=2 -> wordpress would successfully pass the parameter to the page.
After i upgraded to the WP 3.4, wordpress would do a redirect and the url would get changed to website.com/menu/2/ which means that the page does not get the parameter and can't go to the page 2. (I don't know if anyone noticed but it seems buddypress.org suffers from the same illness)

Just go to http://buddypress.org/extend/plugins/ and try going to page 2 and you will see what I am referring to. The symptoms I describe may be different from what was described in the linked post, but I am pretty sure they have the same root cause.

comment:9 @ocean903 years ago

  • Keywords reporter-feedback removed

taropaa, thanks. duck_ will investigate it and will create a new ticket for your issue. We will use this ticket then for the %post_id% stuff.

comment:10 @duck_3 years ago

  • Component changed from Permalinks to Rewrite Rules
  • Description modified (diff)
  • Summary changed from Passing query parameters via URL to Use of $walk_dirs for post permastructure is relied upon
Note: See TracTickets for help on using tickets.