wpseek.com
WordPress开发者和主题制作者的搜索引擎
get_the_excerpt › WordPress Function
Since0.71
已弃用n/a
› get_the_excerpt ( $post = null )
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: | |
| Change Log: |
|
Retrieves the post excerpt.
Related Functions: the_excerpt, get_comment_excerpt, get_the_generator, the_excerpt_rss, get_the_terms
源码
function get_the_excerpt( $post = null ) {
if ( is_bool( $post ) ) {
_deprecated_argument( __FUNCTION__, '2.3.0' );
}
$post = get_post( $post );
if ( empty( $post ) ) {
return '';
}
if ( post_password_required( $post ) ) {
return __( 'There is no excerpt because this is a protected post.' );
}
/**
* Filters the retrieved post excerpt.
*
* @since 1.2.0
* @since 4.5.0 Introduced the `$post` parameter.
*
* @param string $post_excerpt The post excerpt.
* @param WP_Post $post Post object.
*/
return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
}