A WordPress-centric search engine for devs and theme authors



get_the_id ›

Since2.1.0
Deprecatedn/a
get_the_id ( No parameters )
Returns:
  • (int|false) The ID of the current item in the WordPress Loop. False if $post is not set.
Defined at:
Codex:

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



Source

function get_the_ID() {
	$post = get_post();
	return ! empty( $post ) ? $post->ID : false;
}