WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to achieve a similar effect to get_page($id), but with the current post acting as the argument for get_post(). Something like this pseudocode: get_post($this=>ID); .

Seems simple, but I can't find the it in the docs.

share|improve this question

You can simply call get_post(), it returns the current post if no ID is specified.

get_the_ID() actually does the same.

share|improve this answer

Found it here: http://stackoverflow.com/questions/4893435/getting-the-wordpress-post-id-of-current-post

$id = get_the_ID();
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.