wp_maybe_generate_attachment_metadata( WP_Post $attachment )

In this article

Maybe attempts to generate attachment metadata, if missing.

Parameters

$attachmentWP_Postrequired
Attachment object.

Source

			'ids' => implode( ',', $ids ),
			'src' => $srcs,
		);

		continue;
	}

	// Otherwise, extract srcs from the innerHTML.
	preg_match_all( '#src=([\'"])(.+?)\1#is', $block['innerHTML'], $found_srcs, PREG_SET_ORDER );

	if ( ! empty( $found_srcs[0] ) ) {
		foreach ( $found_srcs as $src ) {
			if ( isset( $src[2] ) && ! in_array( $src[2], $srcs, true ) ) {
				$srcs[] = $src[2];
			}
		}
	}

	$galleries[] = array( 'src' => $srcs );
}

Changelog

VersionDescription
3.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.