I am currently implementing a filter hook based on
the_content hook. I need to retrieved the
$post->ID, unfortunately this value is not accessible (or not set already) within the hook call.
Although I noticed that calling
the_ID is working. But for my own regex purpose I need to actually retrieve the ID value rather that simply echo it.
For now, I am using
global $id to access the current post ID. But I feel this is not a clean approach since
$id is not supposed to be directly accessed that way.
What would you suggest as a clean approach to this problem?