wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
_wp_preview_post_thumbnail_filter is private and should not be used in themes or plugins directly.
_wp_preview_post_thumbnail_filter › WordPress Function
Depuis4.6.0
Dépréciéen/a
› _wp_preview_post_thumbnail_filter ( $value, $post_id, $meta_key )
| Accès: |
|
| Paramètres: (3) |
|
| Retourne: |
|
| Défini(e) dans: |
|
| Codex: |
Filters post thumbnail lookup to set the post thumbnail.
Fonctions en relation: _wp_preview_meta_filter, _wp_preview_terms_filter, _wp_post_thumbnail_html, preview_theme_ob_filter, set_post_thumbnail_size
Source
function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
$post = get_post();
if ( ! $post ) {
return $value;
}
if ( empty( $_REQUEST['_thumbnail_id'] ) || empty( $_REQUEST['preview_id'] )
|| $post->ID !== $post_id || $post_id !== (int) $_REQUEST['preview_id']
|| '_thumbnail_id' !== $meta_key || 'revision' === $post->post_type
) {
return $value;
}
$thumbnail_id = (int) $_REQUEST['_thumbnail_id'];
if ( $thumbnail_id <= 0 ) {
return '';
}
return (string) $thumbnail_id;
}