WordPress函数:is_customize_preview 是否在自定义设置程序中预览网站

江河/ 2023年09月22日/ WordPress/ 浏览 474

函数原型:


is_customize_preview(): bool


是否在自定义设置程序中预览网站。


函数源码:


function is_customize_preview() {
	global $wp_customize;

	return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview();
}


使用举例:


if ( is_customize_preview() ) {
    // perform customizer specific action
} else {
    // perform separate action
}


发表评论

暂无评论,抢个沙发...

客服 工单