Look at the very last part of that query– LIKE '%\"17497\"%'
. You are searching for any characters, followed by literally "17497"
, followed by any characters. I am pretty sure that is not what you want. I think you want any characters, followed by 17497
without the quotes, followed by any characters.
That means the meta_query
is written incorrectly.
$meta_query = array(
'key' => 'lineup_artists',
'value' => $ArtistID,
'compare' => 'LIKE'
);
You don’t want to be adding your own quotes like that.
You also want to be checking that $ArtistID
has a value before trying to use it, and you should be doing some data sanitization and validation before using information in $_POST
. $_POST
data is not safe data.
Related Posts:
- Using OR conditions in meta_query for query_posts argument
- How To Fix WP Query Returns Results But Shouldn’t?
- Include post content of linked posts in search
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- WP_Query with “post_title LIKE ‘something%'”?
- Pagination with custom SQL query
- Display List Of Posts Containing a Relationship Field Value [ACF]
- Whats the difference between post_limits and pre_get_posts?
- ACF Relationship Field Search Filtering [closed]
- Is it possible to wrap Geo Location search around WP_Query?
- Is it possible to select against a post’s parent’s fields with WP_Query?
- Extending WP_Query — Optimise SQL query
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- How to filter sql only for a specific post type
- How to make an activities stream mixing posts and comments?
- SQL Statement generated by WP_Query not producing expected results
- WordPress meta_query and order by custom field
- What is an efficient way to query based on post_meta?
- SQL query equivalent to WP User Query
- Revolution Slider Orderby Two Custom Fields
- Recommended way to drop a pending query (in pre_get_posts)?
- how to retrieve specific product attribute value in an sql query?
- meta_query with array as value
- query posts in functions.php and update a field
- Filter WordPress posts by between parameter
- SQL User Query by Multiple Roles using PHP
- Advanced WP Query hogs the SQL server
- SELECT * FROM $wpdb->posts WHERE ID > 160
- Minimising number of queries on a page when using Advanced Custom Fields
- Query Posts depends on custom field inside repeater field using acf
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- ACF Relationship + WP Template Parts
- Query post with meta_query where date is not in future
- Minimising Database Queries when using Advanced Custom Fields
- ACF – Get lowest & highest value from field
- WP User Query get all authors with last name starting with specific letter
- Select from wp_post and multiple meta_value from wp_postmeta
- If two first numbers exist in wp_meta_query value
- WP_Query meta_query >= date
- How to correctly pass values to wpdb->prepare()?
- Sort users by “birthday” using WP_User_Query
- $wpdb select date range of posts
- ACF Date Based wp_query
- Multiple taxonomy And acf filter group by
- List of the years with posts presented
- Custom query based on meta key – Reduce three states to two in results?
- Include custom field in Ajax search WordPress
- What is the random string I am seeing when I use get_query_var?
- SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)
- Slow WP_Query for custom post type
- Complex WP SQL Query
- Any number in meta key (wp query)
- Query that loads a custom type AND posts whose ids are not inside those custom types custom fields
- How do I run through a WordPress loop called from a filter function?
- Optional Meta Query
- Sorting events by descending date, and ascending time if multiple events on a date
- How can I display a custom field from all posts and order them individually from their parent post
- Editing the default wordpress search
- WP Query related posts by tags
- Order by summing multiple values
- Is there a way to work with a specific the_field from an already queried post? [closed]
- How to Union two different conditions in one WP_Query
- How to extract specific post
- Woocommerce – Changing the order of the upsell products [closed]
- Changing sort order for presentation by Jetpack infinite scroll
- Excluding pages in WP_query using ACF
- How to do a wp_query with two acf-fields, sorting on one of them
- Using Advanced Custom Field for file upload, how do I load the file url
- Include data from custom table in WP_Query
- Multisite wp_query & switch_to_blog issue
- Stuck in the query loop
- Get all fields inlcuding “ACF” (Advanced Custom Fields) columns in wp_query
- WP_Query with meta_query dosen’t return results
- Is there a better way to pull in custom content without querying posts?
- How to pass orderby params to $wpdb->prepare()?
- Debugging wp_query orderby for taxonomy
- Is it possible to query from external database? [duplicate]
- WP User Query with Custom Fields and Search Results
- Make a SQL query with wpdb in WordPress
- Getting additional columns from sql
- ACF accessing a field from the query, but not in post
- List of ways to access WordPress database?
- filter wp_query result with custom field values
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Merge 2 custom post type posts and taxonomy terms and sort ascending
- Add ACF field in a query
- Getting rid of unwanted nonSQL syntax characters when debugging a query
- How I can change the condition or compare operator for WP_Query in pre_get_posts
- JSON – Create rest api endpoint for Advanced Custom Fields
- Query where ANDing slug values not working
- Slow Query On Search
- WP_Query: apply an SQL function to meta fileld value
- Expecting statement error from php loop using ACF plugin
- Custom query filter by ACF date custom field
- Get a list of ACF Repeater-Fields as array
- WordPress dynamic AJAX query
- How to avoid filling up an array each time I run a WP_query?
- How to SQL query posts IDs by categories AND authors?
- Randomly select one of last 3 posts
- WP Query orderby ACF boolean values and ACF field value