WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#6857 closed defect (bug) (invalid)

ob_start on 'admin_head' action broke in 2.5.1

Reported by: rainwater Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5.1
Component: General Keywords:
Focuses: Cc:

Description

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|', $_SERVERREQUEST_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.

Change History (4)

comment:1 @ryan7 years ago

Maybe due to [7805]

comment:2 @rainwater7 years ago

I tried commenting that out, but the issue still occurs. It does appear it could cause problems by dropping the buffer there though. Unfortunately, there must of been another change causing this particular issue.

comment:3 @ryan7 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

comment:4 @DD327 years ago

  • Milestone 2.9 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Given that this has been broken for 2 major releases aparantly, I'm closing as invalid, on the thought that this is most likely invalid under todays trunk, Re-open if necessary

Note: See TracTickets for help on using tickets.