It looks like you’re saving a PHP std object in the database. It might be an array, I’d have to check how WordPress saves those. In either case:
If you’re using add_user_meta()
or update_user_meta()
to insert the user meta into the database (and you should be), then using get_user_meta()
with the third parameter set to true
should return a single object/array that is identical to the one that you inserted into the database.
$following_users = (object) [ '1' ]; /* or just the array */
update_user_meta( $user_id, 'my_user_meta_key', $following_users );
$users = get_user_meta( $user_id, 'my_user_meta_key', true );
$users and $following_users should be identical. So get the user IDs however you saved them.
Related Posts:
- Changing user_nicename
- How to track a users progress through pages by inserting data into WordPress Database?
- User management system similar to wordpress one?
- is_user_logged_in() not working in homepage
- How to set max users to 17.000
- How to connect database table to each registered wordpress user.
- Let users register weight each day and save it in DB
- Getting invalid user ID error when creating a new user with wp_insert_user
- Fatal error: Call to undefined function mysql_connect()
- Query both first_name and last_name from wp_usermeta at the same time
- Display user’s total comment count outside The Loop
- Create Image Uploader for Widget
- How to add query vars with paginated URLs?
- Displaying a variable stored in functions.php inside widget
- How to Join two tables from separate databases within WordPress
- simple wordpress ajax plugin not working when not logged in
- Install will not load: PHP does not have MYSQL installed
- Insert post without actions/hooks
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- automated tests as a user?
- How to get the post_id from postmeta
- Sortable admin column for one meta key with three possible meta values
- AJAX in WordPress, sending coords data to MySQL and show after into map
- register_activation_hook isn’t adding table to DB
- How to group 2 radio buttons in a widget?
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- Converting MYSQL to WordPress $WPDB
- custom widget on the footer
- Is there a way to get 3+ dimensional array from a single MySql command
- Custom Plugin For Converting CSV To MySQL
- Get all user meta by meta key instead of ID
- Missing sidebar parameter “fix” – before_content
- Checking for new message using AJAX and PHP. Server overload?
- Dynamic Sidebars & Echo
- Importing Geo data into wordpress database
- Programmatic Login from 3rd Party site
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- Get users that likes the post
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- wp query foreach deleting record returning only first or last item
- inserting a post from an extern php file but post content doesn’t show on wp site
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- $wpdb->wp_users returning empty value for
- Force Users To Relogin
- Basic wpdb update question
- A $_POST should occur when submit form but is not?
- Pull MySQL data from multiple tables and merge into 1 PHP array
- WordPress widget and customize.php not working in Ubuntu16.04 VPS
- Using CFDB7 vs Custom MySQL Database [closed]
- How can I Use 2 databases with one WordPress install
- ‘pre_user_query’ interfering with user export
- Why won’t this wpdb get_results query return results?
- Show different website layout if no sidebar added
- Adding data to custom wordpress database table
- select a single val though a table in wordpress
- How can I call a specific file (via php) by referencing the logged-in username?
- populate select options from extra mysql table data
- Display additional user fields
- Removal of all posts content in bulk, keeping the posts itself
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- How to store checkbox data for individual users?
- Sort new column in Users wp-admin
- AWS Lightsail WordPress – connect to database on instance using mysqli
- call to undefined function mysql_connect
- Usermeta data unserialize, extract and display in table in WordPress
- I can’t separate the array by commas
- Hide Approved status for certain users in users list
- Using wpdb to connect to a different database is not working
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- Export WordPress User Meta to CSV/Excel
- How can i limit the number of posts to the most recent 6 in my query?
- Allow specific user to edit a specific page
- Help hooking into user_register
- Dynamic_sidebar load in string makeup
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- Featured Products not showing up in “Featured” area of homepage
- Prepared DB Query from _POST array
- Matching multi user
- Add disclaimer before certain posts and pages
- How to list categories by page id in wordpress
- Conditional statement within WP SQL query
- WordPress upload images not displaying
- WP_Widget dynamic field array with external AJAX
- two wordpress sites, two themes, one database, same content
- how to check for wordpress Query errors
- Adapting a php array to WordPress
- Splitting One Big WordPress Site into Multiple Small Sites
- Name Input from widget displays Sidebar name instead of saved data
- WordPress – show number of comments for each post in widget
- MySQL database migration to WordPress
- PHP Widget and do_shortcode
- How to define template directory in this widget code
- Custom query_posts() parameter
- Query Concatenation
- Forbid certain users to access a specific page
- Display total count of products in orders of a specific order status
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- Putting form result in my database
- How can I update a value of a field depending on outside source?