[wp-trac] [WordPress Trac] #21580: check_and_publish_future_post() should set global $post

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 18 17:20:30 UTC 2012


#21580: check_and_publish_future_post() should set global $post
--------------------------+----------------------
 Reporter:  MattyRob      |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Cron          |     Version:  3.4.1
 Severity:  major         |  Resolution:  wontfix
 Keywords:                |
--------------------------+----------------------

Comment (by scribu):

 Replying to [comment:8 MattyRob]:
 > As a supplemental, I tried the code you pasted above and it throws an
 error:
 >
 > Warning: Missing argument 2 for transition_hook() in
 /Users/Matthew/Sites/trunk/wp-content/plugins/transition_checker.php on
 line 8
 >
 > I suspect this is because the function is expecting 2 parameters but the
 action from old to new status only passes 1 variable - namely $post.

 Yes, you need to tell add_filter how many parameters you want back:

 add_action('draft_to_publish', 'transition_hook', 10, 2);
 add_action('future_to_publish', 'transition_hook', 10, 2);

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21580#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list