How do I display the value of an array in my template?

I am using wordpress plugin,

import-users-from-csv plugin upload csv error in text file.

I need a help error log displaying the same screen, displaying an array value print_r();

but display on my screen an error in my foreach

loop.help with my loop correct foreach

.

 Array
(
    [0] => WP_Error Object
        (
            [errors] => Array
                (
                    [existing_user_login] => Array
                        (
                            [0] => Sorry, that username already exists!
                        )

                )

            [error_data] => Array
                (
                )

        )

    [1] => WP_Error Object
        (
            [errors] => Array
                (
                    [existing_user_login] => Array
                        (
                            [0] => Sorry, that username already exists!
                        )

                )

            [error_data] => Array
                (
                )

        )

)

      

I am using displaying this array value in this foreach, but the value is not displayed, Help with us

foreach($nerrors as $key=>$err)
        {
            echo $err['errors']['existing_user_login'][$key];


        }

      

+3


source to share


1 answer


Edited by

foreach($nerrors as $err)
    {
        echo $err->errors['existing_user_login'][0];

    }

      



errors are an element of an object, not an array.

Please, check him.

+2


source







All Articles