我试图在首页上隐藏店面页面标题。这段代码从各个方面隐藏了它:
function sf_change_homepage_title( $args ) {
remove_action( 'storefront_page', 'storefront_page_header', 10 );
}
add_action( 'init', 'sf_change_homepage_title' );
但我不能用is_front_page(),因为WordPress的负载的functions.php的$ wp_query对象已经设置了当前页面之前,作为解释在这里。
我宁愿不使用插件“店面主题标题切换”。
谢谢你。
解决方案是将“ init”替换为“ wp”:
add_action( 'wp', 'sf_change_homepage_title' );
谢谢。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句