wp_initialize_theme_preview_hooks()
Add filters and actions to enable Block Theme Previews in the Site Editor.
The filters and actions should be added after pluggable.php is included as they may trigger code that uses current_user_can() requires functionality from pluggable.php.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wp_initialize_theme_preview_hooks();
Список изменений
С версии 6.3.2 | Введена. |
Код wp_initialize_theme_preview_hooks() wp initialize theme preview hooks WP 6.6.2
function wp_initialize_theme_preview_hooks() { if ( ! empty( $_GET['wp_theme_preview'] ) ) { add_filter( 'stylesheet', 'wp_get_theme_preview_path' ); add_filter( 'template', 'wp_get_theme_preview_path' ); add_action( 'init', 'wp_attach_theme_preview_middleware' ); add_action( 'admin_head', 'wp_block_theme_activate_nonce' ); } }