Get all images from published posts
-
Hello, I’m using get_children to retrieve all images from my site like
$images = get_children( 'post_type=attachment&post_mime_type=image&numberposts=-1&order=ASC&orderby=menu_order&post_parent=' )This returns ALL images, not just published ones. I’m not 100% sure what is happening but it states here get_children sets the post_status param to ‘inherit’ as it presumes to be used with a defined parent, however I don’t want to define a parent, just get all images are from published posts.
Any idea how to do that? Seems like a simple task.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Get all images from published posts’ is closed to new replies.