First of all – I assume the $search variable is being populated from $_GET (it’s not in your code).
Secondly, do you need the % ? I think using LIKE with wp_query doesn’t require them.
Related Posts:
- Use REGEXP in WP_Query meta_query key
- Getting attachments by meta value
- What is an efficient way to query based on post_meta?
- WP_Query not working as expected for attachments and custom meta_query
- How can I create a WP_Query that returns posts where one meta_value
- WordPress altering my custom query, How to fix it?
- WP Meta Query for some meta (array) values
- How to get sum of meta_values of a meta_key in wp_query according to conditions
- Order posts by meta value and Date
- Get meta info related to current post
- How to make Meta Query case sensitive?
- Performance when getting post meta for post retrieved by meta value
- Get attachment by meta_key value
- Fetch Record based on meta key dates
- how to make members list directory through wordpress post custom meta key.
- Large AND OR query timing out
- Filter posts by comparing custom meta value against postdate
- Nested array issue in meta_query
- WP_Query meta compare must include ALL array values
- How do i create a custom post query when the meta value is an array?
- wp query to use both author id and meta_query
- Meta query ignores multiple values of the key
- Trouble with serialized metadata
- show most viewed post
- Why can my filter query SOME metadata but not other metadata?
- Query against multiple locations within single custom post type post
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- Saving custom fields for WP_Query to retrieve
- How to show all the associated posts with specific date of data metabox?
- WP Meta Query at depth 2
- WP_Query Posts by Metadata from Option Tree
- Return a single custom post from multiple meta queries
- WP_Query by meta key not returning any posts
- Meta_query compare operator explanation
- meta_query ‘compare’ => ‘IN’ not working
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query with checkbox meta_query
- ACF Relationship Field Search Filtering [closed]
- What is the most efficient way of querying posts based on visits and date for current day?
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- Meta Query with date and time on the same Day before given time
- How to grab metabox value in wp_query meta_query key
- Is “orderby” in WP Meta Query conflicting with Meta Query?
- How to count post meta key values for all posts in database
- Sort users by meta_value_num
- How to count data records in wordpress which have same meta_value in wp_postmeta table?
- Meta_query with or without value
- Query Posts depends on custom field inside repeater field using acf
- wp_query not searching with apostrophe
- Add condition of user capability in WP_query
- Custom query based on meta key – Reduce three states to two in results?
- Any number in meta key (wp query)
- How to display multiple custom fields with the same meta_key in an ascending order?
- Meta_query with multiple keys and multiple values
- Is it a good idea to improve meta query performance by adding tax query?
- Modify wp-query and sort by post meta key
- How do I query for posts by partial meta key?
- Orderby listing issue
- How to increase load time of an archive/search page (WP_Query)
- get_post_meta in WP_Query
- Make meta query treat meta_value as 1 or 0
- WordPress query posts with multiple post_meta data
- Is this meta query problematic?
- WP Query Meta Value – How To Identify Specific, Unique Values?
- Order by meta_key doesn’t work
- Appending to existing WP_Query’s meta_query if exists
- Multiple meta_key ordering with pre_get_posts
- Meta query with compare by more than 2 fields
- How to get current page nearest parent id?
- Sort posts using multiple custom fields and menu_order in single query?
- Search filter between promo and exact price
- meta_query – check for multiple meta values in key which holds an array of values
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- Display posts from multiple value in meta separated by comma
- Getting posts by custom field value
- WP_Query on custom key and value
- Get posts having meta value between two numbers
- wordpress multiple meta value query is not working
- Strange results from WP_Query
- update_post_meta performance in a loop woocommerce
- update_post_meta performance in a loop woocommerce
- Pre get posts sort by meta key returns no results if meta key does not exist
- Sorting with meta_query and multiple, optional meta keys
- meta_query with relation = AND not working as expected when combining EQUALS with NOT EQUALS
- Query by meta value (add a dropdown of all values)
- Order Posts By Custom Field That is an array of objects
- WP_Query returns empty if meta_query has more than 7 values
- Use not custom fields in get_posts() meta_query?
- WordPress meta_query not working
- Using orderby with 2 meta keys
- How to get several fields from wp_query?
- Passing conditional arrays to WP_Query() [closed]
- query by meta value then date and not empty meta value
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- wordpress sorting using array merge by price in ascending order but price with 0 must be show last
- Get all user with both meta_value
- How to get all post_id and meta_value using meta_key in wp_postmeta table
- WP Query – Show custom posts only if user contain some user meta
- How do I subquery with custom meta fields?
- Extend search query to search meta keys values based on search string