You don’t need to add the % signs to the value. WordPress does that for you automatically on a LIKE or NOT LIKE comparison. You also don’t need to “sanitize” the parameter, it will be automatically escaped for SQL.
See wp-includes/meta.php, around line 806 or so.
Related Posts:
- How to know if get_posts() failed?
- How to give classname to post if post has no content?
- Related Posts function not working
- How to limit the number of posts that WP_Query gets?
- Should we trust the post globals?
- Random sort within an already sorted query
- How to get previous 10 days post from a specific date – WP Query
- WordPress Number of Posts Not Changing With posts_per_page
- How to add posts to wp_query result?
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- Search query – exact post title match
- posts_per_page doesnt work
- How to start with post number x?
- Exclude posts with empty post_content in wp_query
- Only display a certain number of posts, dependent on how many posts there are available in a query
- Improving WP_Query for performance when random posts are ordered
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Get posts by name and taxonomy term
- Get Posts that are in the current month or later
- Exclude the first ‘n’ number of posts of a tag from home page?
- posts_per_page option limits the number of Gallery items
- How to get posts and comments amount per hour, per year and per month?
- Why Query is returning empty array?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Do not show children of a category
- Query for first 3 posts to change the look and feel
- Exclude some posts from displaying in wp_query based on some condition
- How to retrieve certain number of images from a wordpress post?
- How to convert query sql to shortcode in wordpress?
- How Can I Always Display A Particular Post First Using WP_Query?
- How to show multiple posts thumbnail, title and date in widget
- WordPress Query – Display 5 posts (same post type), each from a given tag
- Fill the exclude array() in get_posts()
- filter posts based on menu_order
- Show 5 posts and than 3 posts offset with pagination
- wp query custom orderby not custom field
- Sort / Filter Queries
- Advanced Post Display/Pagination/Ordering
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Retrieve latest post by multiple categories with ID
- Displaying Results From Custom Taxonomy Query
- WP_Query retrieve custom posts but not the post showing
- How to get single post by one author?
- Wp_query WooCommerce products
- posts_per_page – Repeats only first posts ‘post__in’ array
- get all posts ID from a category
- Accessing the post content with WP_Query
- is there a better way of combining this?
- How to output comments number of a post per day?
- If specific user role then sticky post
- Display posts with comments closed, with pagination?
- Only display posts after current date
- Encrypt / Decrypt Post Title and Details
- Custom WP_QUERY $args
- WP_Query Authors OR Categories
- Why is querying posts messing up my pages?
- Weird orderby => post__in issue
- How to do set post permalinks using 6 digit random unique function?
- get query() without post content?
- Any way for get_next_post() to use the actual post order instead of publish order?
- Dynamically switch template on click
- Get all custom post types excepted some…
- Get all comments of author’s posts
- Get posts with multiple categories
- How to get post content from an array of ids?
- Number of displayed posts
- Query posts and filter at query time by value of custom meta
- Getting blog pagination to work on page set as front page
- search blog posts by author first name and or last name
- Very complex post query
- Delete post revisions only for a single post
- unique post in “$args” of wp_query display more than one post
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- WordPress query portfolio posts
- Get latest author posts inside the loop
- Show only posts with titles/permalinks that do not contain certain words
- Group first, 2nd, 3rd, etc posts by category terms
- Manipulated offset and pagination, can’t display last post anymore
- Query to fetch custom taxonomy along with post title
- How to fetch courses in all languages in WordPress?
- How to Get Position of a Post from a category and tag
- Is it possible to query a category with specified posts?
- Query posts from newest category
- WordPress loop uses unmodified posts array, why?
- Show posts between two Custom Fields date
- Query to get data of a post, if in category?
- Order posts by custom field
- Ordering posts alphabetically by meta keys and title
- Grab next post title in archive page
- Remove duplicated posts in the loop if post has more than one category
- Continuous listing from a custom field
- How to store post rating system data post independent?
- Why I getting only 1 post?
- First post in loop displays twice
- Filters do not work when there are multiple (one works)
- I am using the query block and what I want and see on the editor page is not the same with the actual results
- Batch Scanning and Deleting Empty WordPress Posts