Viewing 1 replies (of 1 total)
  • Thread Starter Vergilius

    (@vergilius)

    Actually, I solved the problem. My solution:

    $photocount=$wpdb->get_var($wpdb->prepare(“SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = ‘attachment’ AND post_parent IN (SELECT ID FROM $wpdb->posts WHERE post_type = ‘my_posttype’)”));
    echo $photocount;

Viewing 1 replies (of 1 total)

The topic ‘Post type attachment count’ is closed to new replies.