You could try the REGEXP
version:
'meta_query' => array(
array(
'key' => 'email_address',
'value' => '^hello@',
'compare' => 'REGEXP',
)
)
where ^
matches the beginning of a string.
You can check the MYSQL reference on REGEXP
here for more info.
Notice that these are the possible values of the meta compare
parameter:
'=', '!=', '>', '>=', '<', '<=',
'LIKE', 'NOT LIKE','IN', 'NOT IN',
'BETWEEN', 'NOT BETWEEN', 'NOT EXISTS',
'REGEXP', 'NOT REGEXP', 'RLIKE'
according to the WordPress 3.9.2 source.
From the MYSQL ref:
Name Description
------------------------------------------------------
NOT REGEXP Negation of REGEXP
REGEXP Pattern matching using regular expressions
RLIKE Synonym for REGEXP
Related Posts:
- compare meta_query in get_posts arguments
- Getting attachments by meta value
- querying with custom meta field with meta_query
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- WordPress altering my custom query, How to fix it?
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- Order by meta_key in custom post type doesn’t affect the query
- meta_key and meta_value not working together
- Order Posts by meta value AND published date
- How to make Meta Query case sensitive?
- Fetch Record based on meta key dates
- Meta_query with multiple keys and multiple values
- meta_query BETWEEN, but the range is stored in the custom field
- Extend product search with meta in WooCommerce
- how to make members list directory through wordpress post custom meta key.
- Large AND OR query timing out
- meta_value_num not ordering all items
- meta_compare not comparing whole integer
- Display posts with specific value first in query
- Get every post with value in meta key
- add_query_arg to compare and display events from a certain date
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- meta_query weird behaviour, static int will work, but not user data
- Query multiple post types, but different order for each
- Order by the first array within a meta_query
- Query ACF relationship field – Comparator IN – Value array
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- How do i create a custom post query when the meta value is an array?
- WP Query – grouping posts by same meta key, adding together values from another key
- meta_query is overriding default search
- Trouble with serialized metadata
- Comparing Meta Field date in WPQuery using Meta_Query?
- Getting posts by custom field value
- Query against multiple locations within single custom post type post
- WP_Query, ACF field and array
- Order by Date Custom Field
- Query by meta value (add a dropdown of all values)
- Order Posts By Custom Field That is an array of objects
- Custom WP_query and integrating into theme file
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Compare meta key separation
- query post based on comparison
- Get posts by meta value except one post [closed]
- WP Query Args – Title or Meta Value
- how to show posts that are missing a meta_value
- WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
- Get_post() with meta_key when compare is a date
- Order by two meta keys
- multiple meta key but get server load is very high
- A WP_Query that will look for posts after 2 weeks ago OR with a certain meta value
- How can I combine meta_query queries?
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- Use meta_query to display events by date in custom field
- wp_query with multiple custom fields
- How to show recent and upcoming birthdays using meta_query
- Using WP_Query and WP_Meta_Query Outside of WordPress
- If two first numbers exist in wp_meta_query value
- WP_Query on custom field and order results
- Tax query clause inside a meta query clause?
- Display custom field meta outside loop, site wide
- Optional Meta Query
- How do I make a meta_query OR relation work? [closed]
- Meta_query on same meta key, with diffrenct values
- Can we return all category (not post) with Custom Query Filter? [closed]
- WP_Query with meta_query dosen’t return results
- How to provide meta_key array to wp_query?
- Order post type by sum of two custom fields
- Meta query compare for ID’s greater than specific ID
- Is it possible to add relation between meta_query and tax_query?
- Order WP_Query results by meta key value in custom query
- Show single posts date, in a page of posts
- WP_Query Class custom field parameters
- meta_query where the meta value is not the post title
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- How to add a “base” filter for all posts visible to visitors on the site?
- meta_query with meta values as serialize arrays
- Woocommerce Get Orders By Meta Value
- Multiple WP_Query args combinations according to post type
- WP_Query multiple value not working
- WP_User_Query Orderby Not Working
- Unusual high query of user meta data
- WordPress Query optimaization for slow query
- Meta query doesn’t remove placeholder escape before query
- How to create URL parameters to run custom queries?
- WP Query Meta Query
- Query custom meta value – post view and date meta
- How can I modify standard search query to include also ACF custom fields values?
- WP_Query – show posts where meta value and user_email match
- Best way to Order Post in Home without a plugin
- WP_Query using meta_query with LIKE doesn’t return what it should
- Loop through multiple custom fields with increasing number
- Return a single custom post from multiple meta queries
- new WP_query using custom fields
- Including ‘cat’ => $cat breaks meta_query
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- Get posts using multiple values from ACF checkbox as meta query wordpress
- WP Query returning all posts when Meta_query is null
- Order custom post type by posts with most likes first