Support » Developing with WordPress » How to get post id in the_content type filter

  • I am trying to get post id in a the_content filter. How to do this in a proper way. Thank you …

Viewing 4 replies - 1 through 4 (of 4 total)
  • ?

    I’m not sure I understand how the filter for post content relates to a post’s ID. Actually, it doesn’t. So, please explain the results you’re after. You just want to collect the ID for a post?

    I have some home made markup tags in the post and i use the_content filter to replace those tags with some content which is associated with being filtered post and stored in a mysql table. I used to use global $post,$post_ID; But now it stopped to function for some reason. Maybe it is better to use some other hook, not the _content to deal with this ?

    Scoping $post to global should then make everything in the post object available:

    global $post;

    The ID can be accessed through $post->ID

    That is so cool. It is really usefull. Thanks…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to get post id in the_content type filter’ is closed to new replies.