wpseek.com
A WordPress-centric search engine for devs and theme authors



get_the_id › WordPress Function

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:

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



Source

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