WordPress.org

Ready to get started?Download WordPress

Forums

Hook for entire post (7 posts)

  1. abrazell
    Member
    Posted 9 years ago #

    I really need to figure out if there is a hook for an entire post... I can't find any. I need more than just the content hook... :(

  2. NuclearMoose
    Member
    Posted 9 years ago #

    Define "more".

  3. abrazell
    Member
    Posted 9 years ago #

    In other words, an "entry" comes with more than content. It comes with everything in "the loop" on a per entry basis -- author name, time of post, permalink, comments link, etc. Essentially, I want to "capture" the entire entry for filtering...

  4. abrazell
    Member
    Posted 9 years ago #

    Everything in the $post object of the loop.

  5. Did you peruse the Plugin API at codex? http://codex.wordpress.org/Plugin_API

  6. abrazell
    Member
    Posted 9 years ago #

    yeah, the closest thing I saw was publish_post and I don't think that's the answer...

  7. topnotcher
    Member
    Posted 9 years ago #

    Action hooks such as publish_post take the id of the post as a parameter. Once you have the id, you can easily get everything else about the post...

    function foo($post_ID = 129) {
    $data = get_postdata($post_ID);
    print_r($data);
    }

    that should output something to the effect of:

    Array
    (
    [ID] => 129
    [Author_ID] => 1
    [Date] => 2005-06-13 16:45:57
    [Content] => post content here...
    [Excerpt] =>
    [Title] => Boiled Dogs
    [Category] => 0
    [post_status] => publish
    [comment_status] => open
    [ping_status] => open
    [post_password] =>
    [to_ping] =>
    [pinged] =>
    [post_name] => boiled-dogs
    )
    as far as permalinks, etc.... Once you have the id of the post, you can get any other information easily... Everything is just a function call/database query away... All the above information can be used to make the permalink.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.