In the first two cases, there’s an array wrapping the object that you have to attend to first. e.g. this should work:
$status = $user[0]->status;
As a sidenote:
In the last case, json_encode() doesn’t, as the name might suggest, turn data into an object with properties that you can access — it turns it into a JSON string. Not very useful here.
You can use json_decode() again to turn the string into an object — but of course why bother, since $user[0] is the object you want in the first place.
Related Posts:
- MySQL “Or” Condition
- Transaction when using WP functions rather than vanilla SQL?
- Can i use php sql functions instead of $wpdb?
- How to validate WordPress generated password in DB using PHP?
- How to get the list of WooCommerce product image of a certain category from database?
- Custom query to get post names beginning with a digit
- How To Make Connection To WordPress Data Base In A Plugin?
- Changing user_nicename
- WordPress will not operate correctly
- tag search using WP_Query
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- How to merge local and live databases?
- How to track a users progress through pages by inserting data into WordPress Database?
- the_author_meta not working
- if statement on database query
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Sortable admin column for one meta key with three possible meta values
- WordPress Ajax Custom Query – High CPU LOAD
- AJAX in WordPress, sending coords data to MySQL and show after into map
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- theme options echoing multiple times
- WordPress 3 – how are passwords stored and how do I compare to them?
- Styling images coming from another blog
- mysqli_real_connect() – authentication method unknown to the client Warnings
- how to echo all tables that start with a prefix
- Do I need to prepare query before get_results(), get_row() and get_var()?
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- How to select WooCommerce products by post_meta and order them
- Is there a way to get 3+ dimensional array from a single MySql command
- Remove one value in dismissed_wp_pointers?
- Can’t get wp_insert_post to work
- Accessing data from a non-WP database/table within a page content
- I want to select the from values from database in WordPress? [closed]
- mysql query from wordpress page using custom table
- User management system similar to wordpress one?
- Importing Geo data into wordpress database
- 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?
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- How can I save unique user data on my site? [closed]
- Long running queries
- 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]
- WordPress Block developer from exporting Database via PHP
- php include not working in custom page
- Force Users To Relogin
- email alert for product availability
- Issue with fetching mysql data and displaying results via shortcode in webpage
- 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
- How do I prepare strings for insertions as values into a MySQL table?
- Using CFDB7 vs Custom MySQL Database [closed]
- add category to posts with tag wordpress
- How can I Use 2 databases with one WordPress install
- Edit Account – read and write to MySQL
- Why won’t this wpdb get_results query return results?
- Adding data to custom wordpress database table
- select a single val though a table in wordpress
- populate select options from extra mysql table data
- 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?
- WordPress low speed after migrating to new host
- Get mysql data for Quick Edit panel
- 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
- Using wpdb to connect to a different database is not working
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- How can i limit the number of posts to the most recent 6 in my query?
- Insert data from form to database
- (Who to follow) Twitter widget
- Rewrite SQL query as a prepared statement and use in foreach loop
- Prepared DB Query from _POST array
- How can I display a query in a page?
- Include a custom field in mysql query
- How to properly send many mysql queries via php and what happens with ajax requests after they are sent?
- Conditional statement within WP SQL query
- Passed variable gets undefined variable error on insert on next page
- How to set up an auto delete post?
- WordPress upload images not displaying
- two wordpress sites, two themes, one database, same content
- how to check for wordpress Query errors
- MySQL database migration to WordPress
- Custom query_posts() parameter
- MySQL update text field with ‘
- Query Concatenation
- Display total count of products in orders of a specific order status
- Execute multiple PHP Snippets causes error?
- what to do after instlling cyberpanel on VPS
- Can’t insert into a database wordpress
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax [closed]
- Updates applied to staging WordPress site affecting production even with different databases
- WordPress Query with meta_key and order by another meta_key