0

I am hooking into a wordpress plugin and it is returning an object - $data. I think the structure of it is below. I did a error_log( print_r( $data, true ) ); to get that structure because I can only access the server logs because it's wordpress

This is the important part. How can I access the user_email variable inside the class. tried searching the web with no luck. Thanks

Array
    (    
    [user] => WP_User Object
            (
        [data] => stdClass Object
                    (
            [ID] => 18
                    [user_login] => somedatahereremovedbyme
                    [user_pass] => somedatahereremovedbyme
                        [user_nicename] => somedatahereremovedbyme-com
                        [user_email] => somedatahereremovedbyme.com
                        [user_url] =>                     
            [user_registered] => 2017-10-09 05:41:19
                        [user_activation_key] => 1507527679:$P$Be3gmAdSS7jMH25OpIwGd/hH5Hriua.
                    [user_status] => 0
                        [display_name] => somedatahereremovedbyme
                )  

1 Answer 1

2

Try:

$user_email = $data['user']->data->user_email;

Sign up to request clarification or add additional context in comments.

1 Comment

I tried $data[0]->data->user_email . Should be the same shouldn't it. didn't seem to work. This is weird.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.