Cast wp_count_attachments() before iterating it to avoid a notice when items exist without a mime type.

props bobbingwide.
fixes #27802.

Built from https://develop.svn.wordpress.org/trunk@28139


git-svn-id: http://core.svn.wordpress.org/trunk@27970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-04-16 00:00:15 +00:00
parent 37af06c565
commit e8020e91fd
1 changed files with 1 additions and 1 deletions

View File

@ -2693,7 +2693,7 @@ function wp_enqueue_media( $args = array() ) {
} }
$audio = $video = 0; $audio = $video = 0;
$counts = wp_count_attachments(); $counts = (array) wp_count_attachments();
foreach ( $counts as $mime => $total ) { foreach ( $counts as $mime => $total ) {
if ( 0 === strpos( $mime, 'audio/' ) ) { if ( 0 === strpos( $mime, 'audio/' ) ) {
$audio += (int) $total; $audio += (int) $total;