WP_Script_Modules::set_fetchpriority
Sets the fetch priority for a script module.
Метод класса: WP_Script_Modules{}
Хуков нет.
Возвращает
bool. Whether setting the fetchpriority was successful.
Использование
$WP_Script_Modules = new WP_Script_Modules(); $WP_Script_Modules->set_fetchpriority( $id, $priority ): bool;
- $id(строка) (обязательный)
- Script module identifier.
- $priority('auto'|'low'|'high') (обязательный)
- Fetch priority for the script module.
Список изменений
| С версии 6.9.0 | Введена. |
Код WP_Script_Modules::set_fetchpriority() WP Script Modules::set fetchpriority WP 7.1.2
public function set_fetchpriority( string $id, string $priority ): bool {
if ( ! isset( $this->registered[ $id ] ) ) {
return false;
}
if ( '' === $priority ) {
$priority = 'auto';
}
if ( ! $this->is_valid_fetchpriority( $priority ) ) {
_doing_it_wrong(
__METHOD__,
/* translators: %s: Invalid fetchpriority. */
sprintf( __( 'Invalid fetchpriority: %s' ), $priority ),
'6.9.0'
);
return false;
}
$this->registered[ $id ]['fetchpriority'] = $priority;
return true;
}