Un motore di ricerca WordPress per sviluppatori e autori di temi



_wp_preview_post_thumbnail_filter ›

Da4.6.0
Deprecaton/a
_wp_preview_post_thumbnail_filter ( $value, $post_id, $meta_key )
Accedi:
  • private
Parametri: (3)
  • (null|array|string) $value The value to return - a single metadata value, or an array of values.
    Richiesto:
  • (int) $post_id Post ID.
    Richiesto:
  • (string) $meta_key Meta key.
    Richiesto:
Ritorna:
  • (null|array) The default return value or the post thumbnail meta array.
Definito a:
Codex:

Filters post thumbnail lookup to set the post thumbnail.



Sorgenti

function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
	if ( ! $post = get_post() ) {
		return $value;
	}

	if ( empty( $_REQUEST['_thumbnail_id'] ) ||
		empty( $_REQUEST['preview_id'] ) ||
		$post->ID != $post_id ||
		'_thumbnail_id' != $meta_key ||
		'revision' == $post->post_type ||
		$post_id != $_REQUEST['preview_id'] ) {

		return $value;
	}

	$thumbnail_id = intval( $_REQUEST['_thumbnail_id'] );
	if ( $thumbnail_id <= 0 ) {
		return '';
	}

	return strval( $thumbnail_id );
}