
什么是WordPress版本控制及最佳解决方案
is_404 ( No parameters )
is_404: 这个函数用来检查当前请求是否是一个404错误页面。如果请求是一个404错误页面,它返回真,否则返回假。
确定查询的结果是否为404(返回无结果)。
关于这个和类似主题函数的更多信息,请查看《主题开发者手册》中的{@link Conditional Tags}文章。
function is_404() { 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_404(); }