[wp-trac] [WordPress Trac] #6857: ob_start on 'admin_head' action broke in 2.5.1

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 27 15:58:25 GMT 2008


#6857: ob_start on 'admin_head' action broke in 2.5.1
-----------------------+----------------------------------------------------
 Reporter:  rainwater  |       Owner:  anonymous
     Type:  defect     |      Status:  new      
 Priority:  normal     |   Milestone:  2.5.2    
Component:  General    |     Version:  2.5.1    
 Severity:  normal     |    Keywords:           
-----------------------+----------------------------------------------------
 We currently use a 'admin_head' filter in our theme to hide specific
 categories on the post-new.php page for specific user roles.  However, in
 2.5.1, there is some type of change that results in the output dying and
 not getting past the html head code.  Here is an example of the code:

 function hide_cats_shell() {
         $out = '<div></div>'; //real code would output only specific
 categories
         return $out;
 }

 function hide_cats_start($c) {
     return preg_replace('|<div id="categories-all" class="ui-tabs-
 panel">.*?</div>|sie', hide_cats_shell(), $c);
 }

 function hide_cats($unused) {
     if(preg_match('|/wp-admin/post-new.php|', $_SERVER['REQUEST_URI'])) {
         ob_start('hide_cats_start');
     }
 }
 add_action('admin_head', 'hide_cats');

 The above code now results in the only the head html being output to the
 browser. Because of this we have had to downgrade our site to 2.5.0 in
 order to continue using it.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6857>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list