get_the_ID()

You are here:

get_the_ID()

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

Return Return

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


Top ↑

Source Source

File: wp-includes/post-template.php

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


Top ↑

Changelog Changelog

Changelog
VersionDescription
2.1.0Introduced.
Was this article helpful?
Dislike 0
Views: 1

Cart

Log in

Create an Account
Back to Top