WordPress获取文章内容函数:get_the_content

WordPress函数get_the_content用于获取文章内容,通常用在主循环The Loop中。

get_the_content( string $more_link_text = null, bool $strip_teaser = false, WP_Post|object|int $post = null )

函数参数

$more_link_text

字符串,默认值:null

当文章使用More标签分隔摘要内容时,get_the_content()函数只返回摘要内容。如果还有更多内容未能显示,将输出一个“更多”按钮,可以提供一个文本值来替换默认的更多按钮文本。

$strip_teaser

布尔值,默认值:false

当值为true,且在文章页面使用该函数时,More标签之前的摘要内容不会输出。

$post

整数或WP_Post,默认值:null

文章ID,或文章对象

扩展阅读

get_the_content()函数位于:wp-includes/post-template.php

相关函数:

阿里云