#16563 closed defect (bug) (invalid)
meta_query should default type to 'STRING'
| Reported by: | batmoo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | 3.1 |
| Severity: | normal | Keywords: | reporter-feedback |
| Cc: | Focuses: |
Description
meta_query defaults the type argument to CHAR which does not seem very intuitive to me (tripped me up when I first started using it). The default should probably be changed to STRING as that's likely to be the most common usecase.
Change History (3)
#2
@
16 years ago
- Resolution → invalid
- Status new → closed
Turns out I was just using it wrong, though, maybe there needs to be a dumb-proofing of meta_query for people like me. Instead of an array of arrays, I was just passing in an array:
$args['meta_query'] = array( 'key' => $meta_key );
That creates some strange SQL. I really should have been doing:
$args['meta_query'] = array( array( 'key' => $meta_key ) );
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
meta_query doesnt appear to support STRING, using that will cause it to revert to CHAR, in the MySQL case here, I'm pretty sure CHAR is the same as what you'd expect STRING to be.
http://core.trac.wordpress.org/browser/trunk/wp-includes/meta.php#L355