[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 16:08:26 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:                |
--------------------------+----------------------
Changes (by MattyRob):

 * keywords:  has-patch =>


Comment:

 Plugins receive certain information as parameters ONLY if it is specified
 as part of the hook. Other parameters may be available if they are defined
 in previous code as a global. Clearly in the case of the draft_to_publish
 hook these items are already being defined.

 You might want to update the codex about globals then and make it clear to
 developers to '''not''' use them, I've been developing plugins for 6 years
 and have never seen anything discouraging use of globals. In fact quite
 the opposite is my interpretation of this sentence at the top of the
 globals page.

 "WordPress-specific global variables are used throughout WordPress code
 for various reasons. Almost all data that WordPress generates can be found
 in a global variable, which makes them very handy and important for
 developers."

 Ticket left as closed though as I expect it's a waste of time re-opening.

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


More information about the wp-trac mailing list