2025年02月07日 建站教程
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
本文链接:http://so.lmcjl.com/news/22690/