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
- How to make WP_Query faster when getting a post from one year ago?
- Display WordPress Post By Date
- Query post for today, if no post get the previous one
- Custom Select Query pagination not working properly
- GUID to related post not in current language
- Query post by meta key of another table
- Get results from the main wp_query
- How to get the current user post and it’s ID?
- Query post category & remove any post id
- How can I display a specific number of post in a category via a url
- Show posts between two Custom Fields date
- Display the latest post from some selected authors
- WP Query between posts custom fields [duplicate]
- Query to get data of a post, if in category?
- Order posts by custom field
- Ordering posts alphabetically by meta keys and title
- How to show the posts list into a static page? Problems to use the loop into a static page
- Grab next post title in archive page
- How do I control the fallback query after the original query returned cero posts?
- Removing a post from the results of a WP Query
- When should you use WP_Query vs query_posts() vs get_posts()?
- Remove duplicated posts in the loop if post has more than one category
- Query posts from a specific category and selected tag
- Continuous listing from a custom field
- Pagination for custom query won’t let me back on page 1
- Order posts by separate menu order for different sub-categories
- Adding a category at even positions on main loop with modified pagination
- Query Posts From Multiple Post Types
- External link not showing on post but showing on comment
- Retrieve posts in custom post type and specific taxonomies
- Sort post by category using HTML Select tag
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to store post rating system data post independent?
- Update Post with Modified Data
- Multiple loops on a Search result page?
- How do I paginate posts page with $wpdb?
- Get first comment link on the post itself
- Can’t get pagination to work
- How to Include a common category in a custom Category Search
- Why I getting only 1 post?
- How to get all post titles starting with numbers and symbols?
- WordPress ultra slow if I click on posts?
- Bulk Attach Or Insert Media To Post Without Opening Post Editor
- The next_posts_link() works only with original $wp_query
- Special Query: Title, Terms, Content – %LIKE%
- What is wrong with this wp_query?
- wp_query select if have comments
- WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1
- Creating pages and getting their values from the database table
- Make division in post_query?
- WP_Query based on a custom field result
- How to limit post query to only return a total count of items with certain post statuses?
- Displaying posts on Homepage