[wp-hackers] Newbie Q - can't get get_children to work

Jan Erik Moström lists at mostrom.pp.se
Sat Apr 11 13:57:46 GMT 2009


I've been trying to figure out why this code says that there are 
no images

$images =& get_children( 
'post_type=attachment&post_mime_type=image' );
if( empty($images) ){
     $result = 'No picts ';
} else {
     $result = 'Picts';
}

My test WP contains two posts and two images, both posts contain 
references to images (inserted using the media manager). If I 
look at the media library it reports two images, one attached to 
each post.

As I read the docs it should report back a listing of all images 
no matter to which post they are attached to ... but for both 
posts I get the result 'No picts'.

I'm obviously missing something ... but what ???

                         jem
-- 
Jan Erik Moström, http://mostrom.eu



More information about the wp-hackers mailing list