#11379 closed defect (bug) (invalid)
Getting "Warning: Cannot modify header information - headers already sent by (output started at..." because of locale plugins
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | I18N | Version: | 2.8.6 |
| Severity: | major | Keywords: | |
| Cc: |
Description
I've written a plugin (to be put as wp-content/languages/pl_PL.php) providing additional localized features for the Polish translation of WordPress as I get "Warning: Cannot modify header information - headers already sent by (output started at..." on pages dealing with sessions (the reason is the filter). Here's the code:
<?php
/* wp-config.php modifications */
$wp_default_secret_key = 'wprowadz tutaj unikatowa fraze';
/* filters */
add_filter( 'date_i18n', 'date_declension' );
/* functions */
function date_declension( $date )
{
$month_names = array( '%Styczeń%', '%Luty%', '%Marzec%', '%Kwiecień%', '%Maj%', '%Czerwiec%', '%Lipiec%', '%Sierpień%', '%Wrzesień%', '%Październik%', '%Listopad%', '%Grudzień%' );
$month_names_genitive = array( 'stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia' );
$month_names_locative = array( 'styczniu', 'lutym', 'marcu', 'kwietniu', 'maju', 'czerwcu', 'lipcu', 'sierpniu', 'wrześniu', 'październiku', 'listopadzie', 'grudniu' );
/* "1 Styczeń..." -> "1 stycznia..." */
$pattern = '%^\d{1,2}\ \w+%';
if ( preg_match( $pattern, $date ) == 1 ) return preg_replace( $month_names, $month_names_genitive, $date );
return $date;
}
?>
Change History (2)
- Milestone Unassigned deleted
- Resolution set to invalid
- Status changed from new to closed
comment:2
waclawjacek — 3 years ago
Oh, right! I forgot it counts as HTML data. :) Thanks!
Note: See
TracTickets for help on using
tickets.

you probably have trailing spaces at the end of your php file.