_wp_register_default_icons()
Registers the default core icons from the manifest.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
_wp_register_default_icons();
Список изменений
| С версии 7.1.0 | Введена. |
Код _wp_register_default_icons() wp register default icons WP 7.1.5
function _wp_register_default_icons() {
$icons_directory = ABSPATH . WPINC . '/images/icon-library/';
$manifest_path = ABSPATH . WPINC . '/assets/icon-library-manifest.php';
if ( ! is_readable( $manifest_path ) ) {
wp_trigger_error(
__FUNCTION__,
__( 'Core icon collection manifest is missing or unreadable.' )
);
return;
}
$collection = include $manifest_path;
if ( empty( $collection ) ) {
wp_trigger_error(
__FUNCTION__,
__( 'Core icon collection manifest is empty or invalid.' )
);
return;
}
foreach ( $collection as $icon_name => $icon_data ) {
if (
empty( $icon_data['filePath'] )
|| ! is_string( $icon_data['filePath'] )
) {
_doing_it_wrong(
__FUNCTION__,
__( 'Core icon collection manifest must provide a valid "filePath" for each icon.' ),
'7.0.0'
);
return;
}
wp_register_icon(
'core/' . $icon_name,
array(
'label' => $icon_data['label'],
'file_path' => $icons_directory . $icon_data['filePath'],
)
);
}
}