get_the_ID() – Retrieve the ID of the current item in the WordPress Loop.

You appear to be a bot. Output may be restricted

Description

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

Usage

$int|false = get_the_ID();

Parameters

Returns

int|false The ID of the current item in the WordPress Loop. False if $post is not set.

Source

File name: wordpress/wp-includes/post-template.php
Lines:

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

 View on GitHub View on Trac