WP_Site_Icon::get_post_metadata
Adds custom image sizes when meta data for an image is requested, that happens to be used as Site Icon.
Метод класса: WP_Site_Icon{}
Хуков нет.
Возвращает
Массив|null|Строку. The attachment metadata value, array of values, or null.
Использование
$WP_Site_Icon = new WP_Site_Icon(); $WP_Site_Icon->get_post_metadata( $value, $post_id, $meta_key, $single );
- $value(null|массив|строка) (обязательный)
- The value get_metadata() should return a single metadata value, or an array of values.
- $post_id(int) (обязательный)
- Post ID.
- $meta_key(строка) (обязательный)
- Meta key.
- $single(true|false) (обязательный)
- Whether to return only the first value of the specified
$meta_key.
Список изменений
| С версии 4.3.0 | Введена. |
Код WP_Site_Icon::get_post_metadata() WP Site Icon::get post metadata WP 7.0.1
public function get_post_metadata( $value, $post_id, $meta_key, $single ) {
if ( $single && '_wp_attachment_backup_sizes' === $meta_key ) {
$site_icon_id = (int) get_option( 'site_icon' );
if ( $post_id === $site_icon_id ) {
add_filter( 'intermediate_image_sizes', array( $this, 'intermediate_image_sizes' ) );
}
}
return $value;
}