#23700 closed defect (bug) (invalid)
publish_future_post action not working
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.4.2 |
| Component: | General | Keywords: | close |
| Focuses: | Cc: |
Description
The API Action Reference for publish_future_post says "Runs when a future post or page is published. Action function arguments: post ID."
However this action does not fire when a post goes from scheduled to published.
I first noticed this on a 3.4.2 install however I have confirmed this in 3.5.1 as well.
Change History (6)
#2
@
13 years ago
1) Add the following to the functions.php file:
add_action ('publish_future_post', 'test_action');
function test_action () {
global $post;
$id = $post->ID;
update_post_meta($post->ID, 'hook_fired', 'true');
}
2) Schedule a post to be published in the future.
3) Review the custom fields data once post has published.
Expected Results: A custom field named hook_fired added to the post with the value of true
Actual Results: No custom fields added to the post
#4
@
13 years ago
- Keywords reporter-feedback added
What happens if you use the $post_id function arg noted in the reference instead of doing global $post? So:
function test_action ( $post_id ) {
update_post_meta( $post_id, 'hook_fired', 'true' );
}
Note: See
TracTickets for help on using
tickets.
Could you provide the steps to reproduce the issue on a clean install?