Opened 2 years ago
Closed 2 years ago
#16703 closed defect (bug) (fixed)
Post permalinks that include %category% should not query the category
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1.1 |
| Component: | Query | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch needs-testing needs-moar-testing |
| Cc: |
Description
3.1 now includes the category in the query when resolving a post permalink that includes %category%. 3.0 did not do this. This results in 'cat' and other category query vars being set for single post queries. This confuses some plugins and unnecessarily complicates the query. %category% is purely decorative since the post name is sufficient to find a post.
Discovered here:
Attachments (1)
Change History (12)
Note that is_category is being correctly set to false. Many plugins seem to be assuming a category query if 'cat' is set, however. One could argue that setting 'cat' is correct, but let's preserve the old expectation as well as get rid of the term query gymnastics for single post queries.
The SQL is indeed altered, but 'cat' isn't set, at least not in my testing.
No problems so far in testing. Single post queries with various permalinks look good. Category queries look good. Seems to fix The Events Calendar.
3.1 query with the patch:
SELECT wp_trunk_posts.* FROM wp_trunk_posts WHERE 1=1 AND wp_trunk_posts.post_name = 'an-event' AND wp_trunk_posts.post_type = 'post' ORDER BY wp_trunk_posts.post_date DESC
comment:10
ryan — 2 years ago
[17505] for 3.1.
comment:11
ryan — 2 years ago
- Resolution set to fixed
- Status changed from new to closed

3.0 query when resolving /%category%/%postname%/:
3.1 query: