To use the LIKE
comparison, try a string:
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => $user_key,
'value' => 'followed', // String here
'compare' => 'LIKE',
),
),
);
return get_posts($args);
Also, you can use WP_Query
to help you debug:
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => $user_key,
'value' => 'followed', // String here
'compare' => 'LIKE',
),
),
);
$query = new WP_Query( $args );
echo '<xmp>';
print_r( $query->result );
die;
$query->result
should contain the generated SQL, and will show you how WordPress is preparing your meta data.
Related Posts:
- Meta compare with date (stored as string) not working
- How metadata API works?
- How to stop wp_postmeta from being called on archive and search pages?
- WP_POSTMETA – What do these values mean inside the data structure?
- How to create a meta_query to get all posts with a specific meta data?
- Compare meta_query with a Regular Expression and do a less-than operation on it
- $wpdb class updating meta_value using Ajax [closed]
- Should I save this mulit dementional arary as one post meta?
- How to check if a post meta key/value pair already exists for a specific post
- get Insert id for meta field
- Filter posts by meta key
- Search post overlapping dates – meta_query with meta_key
- How can I query for posts using a date stored in post-meta?
- I can not display meta value in extras.php and template-tags.php
- Negative meta_query if storing multiple post_meta values with shared meta_key
- How to get posts by meta value as multi-dimensional array?
- Combine meta query and give a specific meta query a higher priority
- Optimize WP Meta Query for large amount of post meta?
- Multiple meta key and value search in the query
- Multiple postmeta values to the same post_id/meta_key combination?
- How to show specific meta keys of all posts in admin panel?
- How to create a link for wordpress meta datas?
- How we insert values into database using metabox WordPress?
- How do I retrieve the slug of the current page?
- How to extract data from a post meta serialized array?
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- Lack of composite indexes for meta tables
- Content hooks vs User hooks
- Add post meta based on another post meta value before publish post
- What is an efficient way to query based on post_meta?
- Save both current and new version of post meta
- get_post_meta – get a single value
- get_post_meta / update_post_meta array
- Can’t sort order of wp_query with 2 meta keys
- Triple meta_key on custom SELECT query
- update_post_meta not adding anything.(Nor add_post_meta)
- Identifying Importer Posts
- Order posts by meta value and Date
- How to sanitize post meta field value?
- Post IDs missing on delete_postmeta action hook
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- How trigger to save post when updating post meta
- Create a Metabox that behaves Like a Taxonomy Box
- Views count with time limit per IP
- order by multiple meta_keys?
- Get meta info related to current post
- echo image caption
- get_*_meta doesn’t always return an array
- Get posts between custom dates
- Generate multiple goo.gl shortlinks for qtranslate bilingual blog
- How can I convert postmeta from unserialized to serialized?
- add_post_meta adds meta to one more different post
- Large AND OR query timing out
- Custom query, multiple custom keys
- Trying to get property of non-object error using get_post_meta()
- Ordering posts by custom field named “date” in backend
- How can I change the tag contents of individual WordPress posts?
- get_post_meta producing white screen of death
- update_post_meta not working in plugin
- Look up all posts by status or meta value – performance difference
- Can A Post Meta Field Store multiple values that are not in an array?
- esc_attr on get_post_meta [closed]
- Sort custom posts in archive by multiple values: date AND meta key
- How is the author’s name given a different color?
- How does WordPress treats attachments metadata in post content?
- change order of images attached to post
- Save meta data with post, Without using any plugin [closed]
- URL to Post Meta [closed]
- Retrieving post meta array (attachment)
- Why is variable that get_post_meta stored in empty?
- Stop `update_post_meta` from working each time page refreshes?
- get_post_meta in one post only
- wpdb->get_var – count author posts, meta value
- Post Publish date not display on Umaya Child themes
- How to merge the database results into single result?
- Filter images from media library by guid meta field
- How can I update this array built from post meta data?
- Custom column on CPT not showing correct value when meta data not set
- How to improve my non-unique metadata MySQL entries?
- Meta query ignores multiple values of the key
- How to get the total of two meta values from different meta keys?
- Get or set values in post meta
- Query against multiple locations within single custom post type post
- Display multiple meta_key/meta_values by single SQL query
- How do you sort the items in a custom taxonomy meta box?
- Twenty Twelve entry meta data – change and move
- How can I prevent the post_modified column in wp_posts from being updated?
- Sorting meta box values by start- and enddate and all dates in between
- Use an id on a button to update_post_meta in post
- get_post_meta image width for lazy load
- Custom Fields help
- Querying meta values within an array
- WP-API : post_meta not updated… but have another entry
- Parse error thrown by get_post_meta [closed]
- How to get all the related ids without array?
- Remove action of an external plugin after checking if custom post meta is set
- wordpress query making site very slow
- if condition from post_meta not working in save_post
- WP Query Args – search by meta_key or title