Cannot modify header information
I got this error when activating theme.
Warning: Cannot modify header information - headers already sent by (output started at /home/server/public_html/wp-admin/includes/plugin.php:1511) in /home/server/public_html/wp-includes/pluggable.php on line 1223 https://site.com/wp-admin/themes.php?page=mytheme-welcome
$config = array(
'directory' => 'inc/merlin', // Location / directory where Merlin WP is placed in your theme.
'merlin_url' => 'mytheme-welcome', // The wp-admin page slug where Merlin WP loads.
'parent_slug' => 'themes.php', // The wp-admin parent page slug for the admin menu item.
'capability' => 'manage_options', // The capability required for this menu to be displayed to the user.
'child_action_btn_url' => 'https://codex.wordpress.org/child_themes', // URL for the 'child-action-link'.
'dev_mode' => true, // Enable development mode for testing.
'license_step' => false, // EDD license activation step.
'license_required' => false, // Require the license activation step.
'license_help_url' => '', // URL for the 'license-tooltip'.
'edd_remote_api_url' => 'https://site.com/edd-api/', // EDD_Theme_Updater_Admin remote_api_url.
'edd_item_name' => 'My Theme', // EDD_Theme_Updater_Admin item_name.
'edd_theme_slug' => 'mytheme', // EDD_Theme_Updater_Admin item_slug.
'ready_big_button_url' => '', // Link for the big button on the ready step.
),
I get the same error(( What is the reason can be?
I don't know. Can't find solution.
@bilalmalkoc the error appears only on my local server. I have tried to install the theme on my hosting and it was ok.
@kaganvmz it is interesting. Because it shows this error in real server, but works in localhost.
@bilalmalkoc It seems I have just solved the problem. Which version do you use? I have used 1.0.0 and I just installed 1.0.0-rc.1 and the issue disappeared.
@kaganvmz I am using latest release Are you sure want to use old version?
@bilalmalkoc No. But it helped to find where is the problem. The problem is on this commit https://github.com/richtabor/MerlinWP/commit/c199cd24a399868d7aa917796962acb549466692 If you do roll back everything will work even on the latest version.
@bilalmalkoc The plugin is printing output (text) to the browser, but then WordPress is redirecting the user (with wp_redirect) away from that page before the whole page is rendered. We can't start printing output and then redirect, or we'll get the error we see.
I've fixed this in my own experience by buffering the output of the script.
In my theme's functions.php file, put the following:
add_action('init', 'do_output_buffer'); function do_output_buffer() { ob_start(); }
And now the plugin is working on the right way even I use the latest version. @richtabor We need your help to understand why is it happens?
@kaganvmz it works now.
same +
It might be a temporary solution.
In case anyone wants to solve this issue in the lastest realease( 1.0.0 ), I solved it by passing second parameter as false in merlin/class-merlin.php L373 like below:
wp_safe_redirect( menu_page_url( $this->merlin_url, false ) );
@sachyya What about Pull Request?
I found the fix for this problem.
wp-content\themes\yourtheme\merlin\class-merlin.php 373 line ))
wp_safe_redirect( admin_url( 'themes.php?page=merlin') );