函数原型
get_the_ID(): int|false
函数描述
Retrieves the ID of the current item in the WordPress Loop.
是否弃用
未弃用
函数参数
无
函数返回值
int|false The ID of the current item in the WordPress Loop. False if $post is not set.
函数位置
File: wp-includes/post-template.php.
函数源码
function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$post = get_post();
return ! empty( $post ) ? $post->ID : false;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |

