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
- Dynamic Sidebars & Echo
- mysql query from wordpress page using custom table
- Importing Geo data into wordpress database
- Show all posts by author
- How can I fix WordPress installation errors?
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- SQL Injection blocked by firewall
- How to check if a meta value has already been assigned to any user?
- Custom user login page by creating a plugin
- How to display data from custom table in wordpress phpmyadmin
- Calculating a large number of MYSQL queries as customshort codes, slow
- Programmatic Login from 3rd Party site
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- How can I save unique user data on my site? [closed]
- Add New User, extra fields which are required?
- user_profile_update_errors hook not executing
- Update results, Before deleting the related category [closed]
- How to make my custom widget appear within WordPress widgets? Plugin development
- Modify user profile data through scripting?
- get widget number from array dynamically
- Sum the total amount of a specific product purchased per user and display in table
- Ordering users by custom user meta
- Adding widgets to my plugin page instead of WordPress dashboard
- Get users that likes the post
- Long running queries
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Replacing mysql_escape_string in a custom plugin when moving to PHP7
- add_cap not working
- Weird 404 URL Problem – domain name being placed at end of urls
- wp query foreach deleting record returning only first or last item
- Refresh table data with Ajax
- Hide subcategories (widget)
- database sent to a JSON file
- Why my image upload button is not working in wordpress widget area?
- Do not execute If User is login as Administrator or any Specific Role
- Adding a widget function into the php theme file
- How to edit widget code to add unique class name to each div?
- inserting a post from an extern php file but post content doesn’t show on wp site
- Database query works fine outside WordPress
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- wordpress archive a user
- $wpdb->wp_users returning empty value for
- Best practice for show data to one specific user?
- Large Woocommerce Site (83,000 items), What Can I Do? [closed]
- $wpdb->insert() does not Insert record in a table
- Using custom tables for old posts
- If has $title in widgets
- Call to undefined function get_userdata() in plugin
- Help with a $wpdb MySQL Query
- WordPress SQL injection
- Archives shortcode displaying above widget title
- Not connecting to database in file with multiple MySQL connections
- Way to bulk make all my tags lowercase?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- Widgets in the loop if active
- How i can obtain all the post meta for a specific post as an array?
- Show latest posts in a plain HTML website custom widget [closed]
- multiple where condition in result query
- get_users meta_query: REGEXP not working for matching new lines
- Change CSS based on is_user_logged_in
- How to determine if the sidebar is empty? Or not active?
- Grouping posts by a custom meta value
- How to show a users bio on a page
- How to make widget title accept php?
- “operation successful” message
- Multiple meta_key in one global $wpdb;
- Is it bad to add html to a widget by closing and reopening the php tags?
- Custom array from a query only write the last row of the query
- WordPress member notification
- Widget back end radio button issue
- Can’t Query Custom Table Using $wpdb Method
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- WordPress Block developer from exporting Database via PHP
- Hook called before text widget save
- $wpdb returns duplicate posts
- php if username is role
- Update postmeta after theme switch
- Mixing variables into an array when inserting values
- Location of core code for database connection and get_header
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- php include not working in custom page
- How do I display offsite database info on my wordpress site?
- Creating Database Table vs. Adding MetaData to Post & User
- Make a database query using WordPress
- Force Users To Relogin
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data