WordPress开发者和主题制作者的搜索引擎



has_excerpt ›

Since2.3.0
已弃用n/a
has_excerpt ( $post = 0 )
参数:
  • (int|WP_Post) $post Optional. Post ID or WP_Post object. Default is global $post.
    Required: No
    默认:
返回:
  • (bool) True if the post has a custom excerpt, false otherwise.
定义在:
文档:

Determines whether the post has a custom excerpt.

For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook.



源码

function has_excerpt( $post = 0 ) {
	$post = get_post( $post );
	return ( ! empty( $post->post_excerpt ) );
}