You need to pass author__in
as an array but that isn’t what you doing with this: ( array( 'author__in' => array( $followed ) ) )
. You are creating an odd set of nested arrays. WP_Query
isn’t going to know what to do with it. A much simplified version should work:
$followed = $wpdb->get_col("
SELECT user_id1
FROM wp_um_followers
WHERE user_id2 = 1"
);
$get_these_posts = array(
'post_type' => 'stream',
'post_status' => 'publish',
'posts_per_page' => '10',
'paged' => $paged,
'author__in' => $followed
);
Notice I used get_col()
. That will return a simple array of IDs.
Related Posts:
- Unserializeing multiple column values that are stored in one database results variable
- How to sort results from a custom database table
- WP database error for comments_popup_link()
- Any possible way to make $wpdb->get_results() return anything else than array?
- Accessing the database from a plugin outside of action hooks
- Create WP_Query to search for posts by their categories or their parent/child categories
- SQL error with custom query
- getting the values of hidden inputs to use them in a php mysql query
- How to query a staging database?
- How to make a parent page for author.php?
- Check if values exists DB
- How to print array of specific item
- save array of objects with update_option
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- How does WordPress know wich language is chosen when there is a database connection error
- Reprinting tags with all attributes
- Set WP_query ‘order’ option by another tables value
- WordPress default Search function inconsistent in WooCommerce Product Titles
- How can I save unique user data on my site? [closed]
- PHP Array Returning [object Object]. Tried existing answers results with no luck
- Is it possible to create a wordpress database with php code?
- Update results, Before deleting the related category [closed]
- foreach loop still echoes array
- Increase offset while looping
- Store a default value for a transient on plugin activation
- Long running queries
- How WordPress reacts to a lack of memory of the server [closed]
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- Split reads to a different connection string
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Execute long and heavy processes
- Dynamic content in template
- Exclude posts based on meta value
- How to pre populate a form field with a link of a current user’s author profile?
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Trying to get a PHP variable defined in a custom post into a javascript file. Null value. Using wp_localize_script
- edit_comment_link is not showing for comment author
- database sent to a JSON file
- Checking array against author id in loop
- inserting a post from an extern php file but post content doesn’t show on wp site
- Query if audio attachment AND/OR custom field
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Using custom tables for old posts
- register_taxonomy() take much queries
- Databases – Submitting data from inputs to database [closed]
- db converts decimal number wrong
- WordPress SQL injection
- Not connecting to database in file with multiple MySQL connections
- Which is the correct way to conditionally enqueue a CSS file?
- Remove author link wherever author’s name is display
- Alter required message using comment form api
- Odd / Even posts add class minus first post
- Advanced Custom Fields – display label and value only if value entered
- meaning of (array)function()
- Grouping posts by a custom meta value
- Filtering a Database Query
- unable to use ‘new WP_Query’ in AJAX call
- wp_force_remove_style’ not found
- Display Data in Table from External Database in WP using Shortcodes
- Is it best to avoid using $wpdb for security issues?
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- Parse error: syntax error, unexpected ‘}’ on get_the_author_meta [closed]
- How can I access string value in an array?
- How can I import an excel column into wordpress database?
- How to use if statement in an array? [closed]
- Blob file download problem
- How to array only one key from another array
- WordPress Block developer from exporting Database via PHP
- How to retrieve the data from the sever and displaying it in a page?
- Filtering a function’ output for a new continued function
- How to list commenters and days since last commented
- How to add div blocks after certain set of post
- Get html data with javascript to php array and store to wordpress database
- Execute a function every hour in the background
- Create page with custom php script and fetched data
- How to overwrite orderby with add_query_var
- Can’t update multiple rows with $wpdb query
- How do I create a numbered list with PHP? [closed]
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- How do I display offsite database info on my wordpress site?
- Creating Database Table vs. Adding MetaData to Post & User
- How to use array in function to get only value I want
- Error while setting role
- Get categories names as an array to use it in theme settings
- working with term_relationships table
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Building a REST API for your web app exposes primary keys of DB records?
- How to get the last category name of a child category?
- How to say if meta_value is greater than 0 in an array?
- How to use two meta_compare in an array?
- Warning: in_array() null given in PHP function
- WordPress query undefined offset in loop
- Most commented posts by time period (last 12h, last 24h and etc)
- Can I make get_users() query global?
- Foreach loop inside an array_merge
- Noindex Posts From Certain Authors In WordPress
- Issue with custom loop in Archive page
- How to display SQL query that ran in WC_Order_Query?