[wp-trac] [WordPress Trac] #18040: Turning on permalinks, CPT rewrites are ignored
WordPress Trac
wp-trac at lists.automattic.com
Mon Jul 11 19:22:17 UTC 2011
#18040: Turning on permalinks, CPT rewrites are ignored
------------------------------------+--------------------
Reporter: andy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.2.1
Component: Post Types | Version: 3.2
Severity: normal | Resolution:
Keywords: dev-feedback has-patch |
------------------------------------+--------------------
Comment (by andy):
Replying to [comment:5 nacin]:
> If the rules are flushed when we're in the admin, then
permalink_structure would become populated with basic rules for post types
(and, I guess, nothing else).
It is already true that rules are flushed when you're in (a subset of) the
admin because GET /wp-admin/options-permalink.php flushes them. However,
this has no effect on, but rather is predicated on, `permalink_structure`.
Flushing populates the array option `rewrite_rules` if there is a
`permalink_structure`, while the string option `permalink_structure` is
what you save on the options-permalink page.
> In a few areas of core, we do check `'' ==
get_option('permalink_structure')` to decide whether permalinks are in
use, rather than checking $wp_rewrite. I imagine many plugins including
some of ours might be the same.
The `permalink_structure` option check is still valid; $wp_rewrite
wouldn't be able to provide a better check in the context of this patch
because it doesn't know that the option is going to change in a few
milliseconds. The problem arose between the time when you clicked Save and
the time when WordPress registered the intention of that click (to enable
permalinks). During init, the plugin called a registration function that
sees permalinks are disabled and infers that there will be no need to add
anything to the `$wp_rewrite` object properties. That inference is the
error behind the error.
> Does this patch risk these rules ending up in the DB even with default
permalinks on?
If anything, this patch will cause erroneous rules to be removed sooner
than they otherwise would.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18040#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list