Forums

Post ID within publish_post action (3 posts)

  1. buzink
    Member
    Posted 2 years ago #

    I'm trying to get a custom value from a post (get_post_meta($post->ID, "Overlay", true);
    ) when it's published (add_action('publish_post', 'wm_addoverlay');).

    I need the post ID for that. How can I get it?

    I tried $post_ID, $post->ID, $_POST['id'], $_POST['ID'] and global $ID, but they don't work :-(.

  2. buzink
    Member
    Posted 2 years ago #

    I was drinking some excellent Belgian beers called Chimay last night and didn't see the obvious solution. As the action works in the script that recieves the form data, all I needed to get the Custom Value data was a $_POST['valuename'] statement.

  3. doncqueurs
    Member
    Posted 2 years ago #

    I like Grimbergen Triple better, but good that you found it!

Topic Closed

This topic has been closed to new replies.

About this Topic