Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End listing comments in wordpress Re: listing comments in wordpress

#86470
kalps1982
Member

Its simple, you are trying to print STDClass object to string. Normally object class can not be converted to string as it has properties assigned to it.

i.e.

$str = “this is string”;
$object = new stdClass();
$object->test = “string in object”.

If you do

echo $str; // it would print “this is string”

but if you do

echo $object; it would put error as you are getting on in comment list.

but if you do

echo $object->test; // it would print “string in object”

I hope you understood what i explained. You can also check how to get comments from wordpress with get_comments at

http://codex.wordpress.org/Function_Reference/get_comments

here they have mentioned “(Array) Comment objects with the following indexes:”

Regards,
Kalpesh Patel (http://www.think-1st.com)