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
- 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?
- How to make an activities stream mixing posts and comments?
- SQL Statement generated by WP_Query not producing expected results
- What is an efficient way to query based on post_meta?
- SQL query equivalent to WP User Query
- Recommended way to drop a pending query (in pre_get_posts)?
- how to retrieve specific product attribute value in an sql query?
- SQL User Query by Multiple Roles using PHP
- Advanced WP Query hogs the SQL server
- Query Posts depends on custom field inside repeater field using acf
- Query post with meta_query where date is not in future
- 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
- How to correctly pass values to wpdb->prepare()?
- Sort users by “birthday” using WP_User_Query
- ACF Date Based wp_query
- Multiple taxonomy And acf filter group by
- List of the years with posts presented
- 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)
- How do I run through a WordPress loop called from a filter function?
- 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 extract specific post
- Changing sort order for presentation by Jetpack infinite scroll
- Get all fields inlcuding “ACF” (Advanced Custom Fields) columns in wp_query
- How to pass orderby params to $wpdb->prepare()?
- Debugging wp_query orderby for taxonomy
- WP User Query with Custom Fields and Search Results
- Getting additional columns from sql
- 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
- 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
- Optimising WP_Query with ACF Fields
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- Nearby locations using Advanced custom fields, maps?
- WP_Query – display posts by custom field and order by another
- Passing a SQL query to the WP Query
- WP_Query() not working as expected
- Excluding posts from search results page with meta query not working
- Form checkbox value going to dynamic URL
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Any way to use FETCH_KEY_PAIR with $wpdb?
- What is the equivalent WP_Query of a SQL Query?
- create custom shortcode wp and put php code in
- Query for getting posts with their custom fields data in WordPress
- How to rearrange posts based on input field values added by WordPress “Advanced Custom Fields”
- WP Query with meta queries
- WP_Query, ACF field and array
- ACF query-pass field value
- Query string order by custom field
- ACF: using two loops, the_field returns field content from another loop
- Calculating efficiently on large amount of data generated by wp_query
- Get posts meta_query by repater field
- What argument does my function need to echo get_results() query results
- Wrap group of wp query posts to parent div by date/year
- Object of class WP_Query could not be converted to int inside shortcode
- Include post_status check within $wpdb query
- Find by post_meta, then sort by post_meta, then sort by date (wp_posts)
- Wrote a WP Cron Plugin and it triggers a fatal error upon activation
- WP_Query within save_post doesn’t include the item that triggered the action?
- Issue in If else condition [closed]
- Can’t get the_content to show
- WP Query to order posts by multiple meta fields
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Get the type of an advanced custom field (ACF) in a WP_Query loop [closed]
- Creating array to compare custom field values
- How to return value from sql and display it
- WP_Query with several meta_query-statements and order by meta_value
- Display all custom meta field values from the database using ACF Repeater
- wpdb LIKE request shows all database data
- Output ACF field dynamicaly within a taxonomy loop [closed]
- Get posts using multiple values from ACF checkbox as meta query wordpress
- How do I subquery with custom meta fields?
- Add custom argument to WP_Query and modify SQL where clause
- Group By query based on Custom Field
- Best performance for use Custom Field in WP
- How to make OR condition in WP_Query