Error: "Cannot modify header information – headers already sent by"
-
Hello !
I just added a bit of code – starting in the code below at “add_filter( ‘postmeta_form_limit’ ) – to my child functions.php and got an error message: “Cannot modify header information – headers already sent by”, when loading almost any page/post.
my functions code:
<?php function improved_trim_excerpt($text) { global $post; if ( '' == $text ) { $text = get_the_content(''); $text = apply_filters('the_content', $text); $text = str_replace('\]\]\>', ']]>', $text); $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); $text = strip_tags($text, '<span>'); $excerpt_length = 42; $words = explode(' ', $text, $excerpt_length + 1); if (count($words)> $excerpt_length) { array_pop($words); array_push($words, '[...]'); $text = implode(' ', $words); } } return $text; } remove_filter('the_excerpt', 'wpautop'); remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter('get_the_excerpt', 'improved_trim_excerpt'); add_filter( 'postmeta_form_limit' , 'customfield_limit_increase' ); function customfield_limit_increase( $limit ) { $limit = 100; return $limit; } ?>I read it is due to improprer code formatting such as “white space” somewhere in the writing.
Can anyone see the error? (the code works, but comes with the above mentioned error)
Thank you so much
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Error: "Cannot modify header information – headers already sent by"’ is closed to new replies.