Client wants to show how many images await the reader in a post. I say: easy peazy. Now I realize: I lied.
The system only uses galleries, even for single pictures.
$images = get_children(array( "post_parent" => $post->ID, // $post->ID gives the right ID. "post_status" => "any", "post_type" => "attachment", "post_mime_type" => "image" )); count($images); // only post with id 12 shows correctly 14 entries
In one post (ID 12, an eaaarly test entry)
$images is filled with the correct amount of entries. In every other post I tested
$images is wrongfully empty.
I even copied the exact same text (from the "Text"-Tab of TinyMCE, not "Visual") to post with ID 298. Still empty
$images. Same custom fields. Both have a thumbnail (even if I delete it, no change) – Same taxonomy-settings..