I've been working on a simple plugin to modify the standard wp_editors. Everything works correctly, but I'm getting a strange error anytime I try to "save" my changes (Options - Settings API). I've read a lot of possible solutions to this issue, but I'm having a hard time finding a solution as I think is very specific to my plugin.
Here is a snippet of my code to establish some context (I removed some sections as its not necessary to show the full code)
<?php
/*
Plugin Name: mmm-editor
Plugin URI: ---
Description: Customization for backend editors
Version: 1.0
Author: Mateo Marquez
Author URI: ---
License: GPL2
License URI: http://ift.tt/XUg0iV
Domain Path: /languages
Text Domain: mmm
*/
//include & register fields
require_once('includes/mmm-settings.php');
//include fields functions
require_once('includes/mmm-fields.php');
//include tiny functions
require_once('includes/mmm-tiny.php');
//include ACF functions
require_once('includes/mmm-acf.php');
//add_action( 'admin_menu', 'mmm_add_admin_menu' );
add_action( 'admin_init', 'mmm_settings_init' );
function mmm_add_admin_menu( ) {
add_options_page( 'mmm-editor', 'WYGIWYS Options', 'manage_options', 'mmm-editor', 'mmm_options_page' );
}
function mmm_stylesheet( ) {
wp_enqueue_style('admin-css', plugins_url('/assets/admin-styles.css', __FILE__));
wp_enqueue_script('admin-js', plugins_url('/assets/admin-scripts.js', __FILE__), array('jquery'), '20120206', true );
}
add_action( 'admin_print_styles', 'mmm_stylesheet' );
function mmm_options_page( ) {
?>
<form action='options.php' method='post'>
<div class="mmm-header">
<h2>WYSIWYG Editor Options</h2>
</div>
<div class="sections">
<?php
settings_fields( 'globalEditor' );
do_settings_sections( 'globalEditor' );
?>
</div>
<div class="sections">
<?php
settings_fields( 'topicsEditor' );
do_settings_sections( 'topicsEditor' );
?>
</div>
<div class="sections">
<?php
settings_fields( 'forumsEditor' );
do_settings_sections( 'forumsEditor' );
?>
</div>
<div class="sections">
<?php
settings_fields( 'blogsEditor' );
do_settings_sections( 'blogsEditor' );
?>
</div>
<?php
submit_button();
?>
</form>
<?php
}
Here is the error dialog that appears any time I try to "Save/submit" my form with the settings slected. Keep in mind this only happens when I got define('WP_DEBUG',true);
. It doesn't seem to affect the behavior of my plugin ( I just have to reload or go back to access the settings page again -- but changes are saved). Even though this work, I don't want to use something with warnings in production. Here is the exact warning log:
Warning: Cannot modify header information - headers already sent by (output started at /Users/mmarquez/Sites/_______/wp-includes/functions.php:3792) in /Users/mmarquez/Sites/______/wp-includes/pluggable.php on line 1228
Any assistance is appreciated - I know this is a common question, but I've tried most of the other suggestions around.
Thanks!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire