[wp-trac] [WordPress Trac] #21432: Deprecate *_blog_option()

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 4 03:28:21 UTC 2012


#21432: Deprecate *_blog_option()
--------------------------+---------------------
 Reporter:  ryan          |       Owner:  ryan
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  3.5
Component:  General       |     Version:  3.4.1
 Severity:  normal        |  Resolution:  fixed
 Keywords:                |
--------------------------+---------------------

Comment (by dd32):

 While this change makes sense to me, I don't see any need to stop using
 *_blog_option and/or deprecating them.

 As they stand, these functions perform a very specific task, Grab another
 site's option without extra code required by the calling functions.

 Although it may be more efficient to use switch_to_blog() when multiple
 options are being requested, it doesn't seem like enough of a reason to
 deprecate the functions, especially when it seemingly doesn't provide
 anything extra to the calling function, let alone changing the semantics
 of the actual operation ("Get blog xyz's option blah" vs "Switch to the
 other blog, grab the option, then come home again") - that's low-level
 stuff that the calling function shouldn't care about:

 {{{
 foreach ( $blogs as $blog_id )
    $sites[ $blog_id ] = get_blog_option( $blog_id, 'some_option' );

 vs

 foreach ( $blogs as $blog_id ) {
    switch_to_blog( $blog_id );
    $sites[ $blog_id ] = get_option( 'some_option' );
    restore_current_blog();
 }
 }}}

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


More information about the wp-trac mailing list