Я пытаюсь добавить ob_start в класс в моем плагине Wordpress, как показано ниже:
class ObStart {
public static function callback($buffer){
return $buffer;
}
public static function add_ob_start(){
ob_start("callback");
}
public static function flush_ob_end(){
ob_end_flush();
}
}
add_action('init', array( 'ObStart', 'add_ob_start' ) );
add_action('wp_footer', array( 'ObStart', 'flush_ob_end' ) );
Кажется, это не работает и вместо этого приводит к этой ошибке:
Warning: ob_start(): function 'callback' not found or invalid function name in <b>\wp-content\plugins\timeline-plugin\obstart.php on line 8
Notice: ob_start(): failed to create buffer in \wp-content\plugins\timeline-plugin\obstart.php on line 8
Warning: Cannot modify header information - headers already sent by (output started at \wp-includes\formatting.php:5520) in \wp-includes\pluggable.php on line 1251
Warning: Cannot modify header information - headers already sent by (output started at \wp-includes\formatting.php:5520) in \wp-includes\pluggable.php</b> on line 1254
Можно ли заставить ob_start работать в классе? Если да, то где я ошибаюсь?