WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#12750 closed defect (bug) (fixed)

A few query bugs...

Reported by: jfarthing84 Owned by: ryan
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Query Keywords: has-patch
Focuses: Cc:

Description

I found a few bugs in query.php relating to attachments and taxonomies.

If you specify 'taxonomy' and 'term' in a query (therefore causing the $post_status_join to be true) and also a 'post_mime_type', it breaks the query because the post mime type is added like "post_mime_type =" rather than "wp_posts.post_mime_type=", making the post_mime_type column ambiguous.

Also, very related is the fact that querying a taxonomy automatically sets the post status to 'publish' regardless of any post status a specify. Why? What if I wanted to query all the drafts of a taxonomy or all of my own custom status?

Attachments (2)

12750.diff (2.3 KB) - added by jfarthing84 5 years ago.
Fix custom taxonomy status and attachment queries.
12750.2.diff (2.4 KB) - added by stephdau 5 years ago.
Patch refresh and patch created from site root, not from within wp-includes

Download all attachments as: .zip

Change History (11)

comment:1 @scribu5 years ago

  • Keywords dev-feedback added
  • Owner changed from dev-feedback to ryan
  • Status changed from new to assigned

comment:2 @scribu5 years ago

Related: #12744

comment:3 @scribu5 years ago

  • Keywords needs-patch added; dev-feedback removed
  • Milestone changed from Unassigned to 3.0
  • Priority changed from highest omg bbq to normal
  • Severity changed from blocker to normal

I think it's pretty clear that both issues should be addressed, but it can't be considered a blocker.

@jfarthing845 years ago

Fix custom taxonomy status and attachment queries.

comment:4 @jfarthing845 years ago

  • Keywords has-patch added; needs-patch removed

comment:5 @scribu5 years ago

  • Keywords needs-refresh added

@stephdau5 years ago

Patch refresh and patch created from site root, not from within wp-includes

comment:6 @stephdau5 years ago

  • Keywords needs-refresh removed

comment:7 @nacin5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14478]) Prevent ambiguous table aliases in wp_post_mime_type_where. props stephdau, jfarthing84, fixes #12750.

comment:8 @nacin5 years ago

The other bug is mentioned in a slew of other tickets.

comment:9 @nacin3 years ago

Follow-up to [14478]#20193.

Note: See TracTickets for help on using tickets.