How to retrieve a value from get_posts()? [closed]
IT Nursery
May 13, 2022
0
I’m just trying to retrieve a value of ‘title_name’ from get_posts and gets the error “cannot use object of type WP_post as array…”
The reason I’m not using have_posts/the_posts is because I want to display the titles in reverse:
As a side point, a slightly easier (and computationally more efficient) way to get your posts in reverse order is to use this instead of array_reverse()
$arr = get_posts(array('order'=>'ASC'));
More fun things you can do with get_posts()’s arguments can be found here and here.