0

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.

2 Answers 2

2

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

get_the_ID() actually does the same.

1

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

$id = get_the_ID();
var_dump(get_post($id));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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