wpseek.com
WordPress开发者和主题制作者的搜索引擎



get_the_id › WordPress Function

Since2.1.0
已弃用n/a
get_the_id ( 没有参数 )
返回:
  • (int|false) The ID of the current item in the WordPress Loop. False if $post is not set.
定义在:
文档:

Retrieves the ID of the current item in the WordPress Loop.



源码

function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
	$post = get_post();
	return ! empty( $post ) ? $post->ID : false;
}