WordPress.org

Ready to get started?Download WordPress

Forums

Obtain Post ID from within 'the_content' filter function (4 posts)

  1. SolarDarkness
    Member
    Posted 8 years ago #

    Hi,
    I'm writing a plugin which needs to add some data to the end of a post, based on statistics generated by the comments. Is there any way to obtain a post's ID from within the function called by 'the_content'? There doesn't appear to be a hook which passes an array of data about a post like there is with some of the comment hooks.

    Thanks for your time,

    Solar

  2. Make $post global within your function and then you can use $post->ID.

  3. SolarDarkness
    Member
    Posted 8 years ago #

    Ah nice - I knew it would be something simple like that.

    Thanks :-)

  4. No prob. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags