You need to unserialize()
if its serialized string.
In your case from what I understand you store the array in the user_meta so its serialize it when you store it. but it will unserialize it when you use the get_user_meta
so you dont need to unserialize()
Your code seems fine.
$author_in = get_user_meta($current_user->ID, 'following_users', true);
$first_post_ids = get_posts( array(
'fields' => 'ids',
'post_type' => 'the_posts',
'author__in' => $author_in
));
Related Posts:
- Can an array be used as a meta_query value?
- How do I dynamically generate args for wp_query?
- How to use $query->set with post__in?
- Exclude posts based on meta value
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- How can I split my query result in 2 arrays?
- array_rand not working correctly?
- Order a WP_Query by meta value where the value is an array
- Using multiple variables to assign categories to an array
- Sending simple variable on single page to WP JSON
- in_array not working on dev server but works on localhost
- Combine multiple queries, array_unique returns nothing
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Build a content and excerpt grid loop with paging and options for # of posts
- wp_delete_post deletes all posts instead of just expired ones
- Trim first 2 words of the exceprt
- Looping through WP_Post Object
- Using a javascript file to access a get posts array
- Generate an array of parent/child page IDs, based on parent page name
- How do I output a database option that is an array into a get_posts array?
- Display Post co-authored in Author Page
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- Sorting Posts | Alphabetical Order
- Looking for most performant way to execute several similar WP queries within shortcodes
- Get the last month with posts using a recursive function…
- Recent posts with featured image or fallback image with permalink
- Storing Array from returned database query and using the array in a new query
- How to use an associative array in post__in with WP_Query?
- WordPress, AJAX and pre_get_posts using conditional tags
- Remove echo from shortcode
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- Fatal error: Call to a member function query() on a non-object
- Advanced Custom Fields – display label and value only if value entered
- unable to use ‘new WP_Query’ in AJAX call
- wp_force_remove_style’ not found
- How can I access string value in an array?
- Filtering a function’ output for a new continued function
- Trouble inputting variable into WP query
- How to say if meta_value is greater than 0 in an array?
- If Array Values Match Another Array’s Values, Then
- How to hide posts of a specific custom category in WordPress?
- I’m unable to call img path using single quotes in an array?
- WordPress meta_query >= &
- Do not duplicate posts with multiple categories in multiple loops
- Separate array output into a
- Dividing the loop to style post differently
- add the value of a variable returned in a while loop [closed]
- Displaying Event within two given time frames
- Remove Post if Advanced Custom Field is checked to fix paging
- Update value of a associative array with update_post_meta
- WordPress SQL JOIN query
- WP_Query and help with the loop for magazine front page
- Search AJAX Filters – Multiple Query Loops Into One Loop (Optimization)
- WP_Query: How to get results from both meta_key options?
- MySQL Query Returns Array () In Shortcode
- How to WP_Query posts order by parent title?
- search.php to search only the post title
- Output product category link from WP_Query
- Passing in MySQL prepare statement parameter separately throwing error
- Create an array with all the links of the years’ archive (of a custom post type)
- Redux option doensn’t seem when include from functions.php
- Load more posts using AJAX based on posts inside WP_Query
- Custom search query on WordPress page not working
- How to select post ID for given parent name with nested prepared queries?
- posts_per_page displays only 2 posts instead of 4 posts
- Use WPQuery to match to specific repeater row in post
- WP_QUERY post_in problem
- how to get data from two different table from wordpress database
- Display one random image from Media Library
- Need to show 7 posts from actual date
- Add code to the header of posts by particular author
- Paged WP_Query is quitting on page 3
- Get Child of Child Pages in custom Menu
- WordPress search query, how to modify the sql
- get_category_parents to array
- Meta query not showing result properly
- Help on Wp_query to print an term
- Include search tags and users in my search results system
- Add custom taxonomy to custom search for posts
- making a search.php query
- How can i iterate through this shortcode array?
- Efficient way of querying for a “fallback” post?
- Only Get A Certain Number of Posts From WP_Query
- Create a hierarchical loop at predefined markup requirements
- Non-array argument in array_merge()-function [closed]
- Use custom get results query to show posts WordPress
- Query seems to be duplicated
- Showing all post from all post type in admin backstage
- Keeping the previous get value and add another value when submitted
- Pagination in category.php not functioning
- Retrieve Array from within Array [closed]
- Changing regular db connection to $wpdb
- Grabbing value of input field inside of array
- Variable ++ in query loop
- a problem in class in class-wp-hook.php
- Count custom posts type and filter by tag
- AJAX WP_Query’s order and orderby parameters not working
- PHP – Converting elements to actual values
- How do I display WooCommerce products in my query to rows of 3?