After doing some more research I found out that my save function does not work well. I think I should apply wpautop
and wptexturize
to those entries.
My save function looks like this:
if ( 'save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }
header("Location: themes.php?page=functions.php&saved=true");
die;
}
Since the wp_editor is defined in the array as wysiwyg
i should be able to get the GET-request to determine whether the field is sent from the wp_editor. I adjusted the code to and now it works:
if ( 'save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
if ($_REQUEST[$value['type']] == 'wysiwyg' ) {
update_option( $value['id'], wpautop(wptexturize($_REQUEST[ $value['id'] ] )));
} else {
update_option( $value['id'], $_REQUEST[ $value['id'] ] );
}
foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) {
if($_REQUEST[$value['type']] == 'wysiwyg') {
update_option( $value['id'], wpautop(wptexturize($_REQUEST[ $value['id'] ] )));
}
else {
update_option( $value['id'], $_REQUEST[ $value['id'] ] );
}
} else {
delete_option( $value['id'] );
}
}
}
header("Location: themes.php?page=functions.php&saved=true");
die;
}
The code might use some improvements, but it works for now 🙂