确定查询是否适用于博客主页。
原型
is_home()
描述
博客主页是显示网站的基于时间的博客内容的页面。
参考:
- is_front_page()
返回值
(bool)
如果博客查看主页,则为True,否则为false。
源文件
路径:wp-includes/query.php
<?php
...
function is_home() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_home();
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/is_home/