• 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 :-(.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter buzink

    (@buzink)

    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.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post ID within publish_post action’ is closed to new replies.