[wp-trac] [WordPress Trac] #11482: Add LIKE to meta_compare
WordPress Trac
wp-trac at lists.automattic.com
Fri Dec 18 12:31:52 UTC 2009
#11482: Add LIKE to meta_compare
-------------------------+--------------------------------------------------
Reporter: joehoyle | Owner: ryan
Type: enhancement | Status: new
Priority: normal | Milestone: 2.9.1
Component: Query | Version: 2.9
Severity: normal | Keywords: meta, query, meta_compare, like, has-patch
-------------------------+--------------------------------------------------
Currently, you can not query for posts with a meta_key LIKE "%star". To
easily allow things such as search posts by meta key I have created a
patch which adds an SQL LIKE to meta_compare.
to use, query for:
{{{
meta_key=url&meta_value=http://www%&meta_compare=LIKE
}}}
Notice the % is included in the meta_value, so you can also do:
{{{
meta_value=%www%
}}}
To get anything with a www in the meta_key. Patch attached
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11482>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list