[wp-trac] [WordPress Trac] #31556: `$wpdb` global object should be retrieved via a helper function to help prevent global stomping

WordPress Trac noreply at wordpress.org
Fri May 1 14:17:06 UTC 2015


#31556: `$wpdb` global object should be retrieved via a helper function to help
prevent global stomping
-----------------------------------+------------------------------
 Reporter:  jtsternberg            |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Query                  |     Version:  4.2
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------------

Comment (by jdgrimes):

 I realize performance may not be a big concern here, but FWIW, a function
 call takes over twice the amount of time as declaring a global. We might
 want to consider just replacing `global $wpdb` with `$wpdb = wpdb()`. Less
 churn, no global, more performant.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31556#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list