WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#15171 closed defect (bug) (worksforme)

Query for category returns pages too (since r15650)

Reported by: demetris Owned by: scribu
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Query Keywords: close
Focuses: Cc:

Description

I have a category with slug misc.

I also have a Page with slug misc.

Since r15650 queries for the category misc also return the Page with slug misc as well as all descendants of this Page.

If you need any more info, please let me know.

Change History (5)

comment:1 @nacin5 years ago

  • Milestone changed from Awaiting Review to 3.1

comment:2 @scribu5 years ago

  • Owner set to scribu
  • Status changed from new to accepted

comment:3 @scribu5 years ago

  • Keywords close added
  • Resolution set to worksforme
  • Status changed from accepted to closed

After talking on IRC, neither me nor even demetris himself was able to reproduce the problem.

comment:4 @scribu5 years ago

  • Milestone 3.1 deleted

Feel free to reopen with steps to reproduce.

comment:5 @demetris5 years ago

OK. Here are some more details:

First, I forgot to mention that the category with the slug misc is also the default category in the site that had the issue.

Now, following scribu’s suggestion on the dev channel, I registered the taxonomy category for pages, to see if any of the pages had the category misc assigned to them.

(This took me more that it should, because I thought the fuction was register_taxonomy_for_post_type. But it is for object type.)

Adding cats to pages showed that some of the pages were in the category misc, while others were in no category at all.

For instance, this page was in the category misc:

http://op111.net/misc/wp-29-props

While this had no category at all:

http://op111.net/misc/wp-30-props

A quick look did not reveal any pattern explaining the difference. Nothing that I could see.

So, I simply unticked misc for the pages that had it, removed the taxonomy registration, and everything is back to normal.

Note: See TracTickets for help on using tickets.