web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. AIGC工具
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站
    手机应用

wordpress利用get_post_field可以获取哪些字段

552 ℃

wordpress利用get_post_field可以获取哪些文章字段,下面web建站小编给大家详细介绍一下具体实现代码!

函数源码介绍:

function get_post_field( $field, $post = null, $context = 'display' ) {
  $post = get_post( $post );
  
  if ( ! $post ) {
    return '';
  }
  
  if ( ! isset( $post->$field ) ) {
    return '';
  }
  
  return sanitize_post_field( $field, $post->$field, $post->ID, $context );
}

$post相关函数介绍:

ID
post_author
post_date
post_date_gmt
post_content
post_title
post_excerpt
post_status
comment_status
ping_status
post_password
post_name
to_ping
pinged
post_modified
post_modified_gmt
post_content_filtered
post_parent
guid
menu_order
post_type
post_mime_type
comment_count
filter
...

get_post_field调用方法:

get_post_field('ID'); // 返回当前文章的ID

WordPress如何判断当前文章是否是密码保护文章

WordPress版本如何使用str_starts_with和str_ends_with函数

WordPress如何显示当前文章的评论个数

wordpress如何显示下个评论链接

wordpress教程如何输出用于回复评论的隐藏输入html

标签: get_post_field, wordpress函数

上面是“wordpress利用get_post_field可以获取哪些字段”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_3570.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > wordpress
本文共计600个字,预计阅读时长4分钟
生活小工具,收录了80多款小工具
上一篇: 程序员正能量文案:乐观积极的治愈系文案,朋友圈满满向上动力句子
下一篇: Lunar组件如何利用I18n实现多语言功能
x 打工人ai神器