[wp-trac] [WordPress Trac] #12993: 'get_current_blog()' and/or 'current_blog_id()' function?
WordPress Trac
wp-trac at lists.automattic.com
Wed May 12 10:48:58 UTC 2010
#12993: 'get_current_blog()' and/or 'current_blog_id()' function?
-----------------------------+----------------------------------------------
Reporter: martythornley | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Future Release
Component: Multisite | Version: 3.0
Severity: normal | Keywords: current blog, blog id
-----------------------------+----------------------------------------------
Comment(by martythornley):
Replying to [comment:2 nacin]:
> > People are currently having to call global variables to use $wpdb,
$current_site and/or $blog_id. I feel all of these are messy and pretty
generic variables to be using within theme or plugin files.
>
> Introducing a *fourth* way to determine blog ID isn't going to get more
cleaner.
>
> The global $blog_id has existed for quite some time, even outside of MU
in regular WP. So that's not going anywhere. Given WP's dependence on
globals already, these should be relied on for the most part.
The whole reason of my bringing this up is I tried using $blog_id in a
plugin that used add_action to add to the init action and it screwed
things up. Using global variables with generic names is bad form. It
requires developers to know every globla variable or else risk redefining
them.
This isn't about introducing a fourth way, it is about introducing THE way
and losing the ones that need intimate knowledge of the core WordPress
functions. Getting the current blog id should be fool proof and currently
it is not.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12993#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list