get_media_items

Advertisement

Summery Summery

Retrieve HTML for media items of post gallery.

Syntax Syntax

get_media_items( int $post_id, array $errors )

Description Description

The HTML markup retrieved will be created for the progress of SWF Upload component. Will also create link for showing and hiding the form to modify the image attachment.

Parameters Parameters

$post_id

(Optional) Post ID.

$errors

(Optional) Errors for attachment, if any.

Return Return

(string)

Source Source

File: wp-admin/includes/media.php

		if ( false === $terms ) {
			$terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] );
		}

		$values = array();

		foreach ( $terms as $term ) {
			$values[] = $term->slug;
		}

		$t['value'] = join( ', ', $values );

		$form_fields[ $taxonomy ] = $t;
	}

	/*
	 * Merge default fields with their errors, so any key passed with the error
	 * (e.g. 'error', 'helps', 'value') will replace the default.
	 * The recursive merge is easily traversed with array casting:
	 * foreach ( (array) $things as $thing )
	 */
	$form_fields = array_merge_recursive( $form_fields, (array) $errors );

	// This was formerly in image_attachment_fields_to_edit().
	if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
		$alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );

		if ( empty( $alt ) ) {
			$alt = '';
		}

		$form_fields['post_title']['required'] = true;

		$form_fields['image_alt'] = array(
			'value' => $alt,

Advertisement

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Advertisement

Leave a Reply