Support Forum
Support › Meta Box AIO › WYSIWYG Not Working Properly
Hello! I am having a couple of issues with the WYSIWYG custom field.
In one CPT/custom field, the WYSIWYG is not saving the "p" tags when pressing enter/return using the visual editor. This means, when I dynamic insert the data on a page, it is create one large paragraph, instead of multiple paragraphs. The only way I can get it to work is by switching to the text editor and manually putting in the open and close "p" tags. These should automatically be input when using enter/return on the visual editor.
on another CPT/custom field, the WYSIWYG is completely broken. It shows I am viewing the visual editor, but none of the edit buttons are visible. In addition, the content box is blank, I can not type in the editor, and I can't click to switch to the text editor view. It simply does not work. If I switch this custom field to a Text Area, I can then see my typed text is still there, but as soon as I switch it back to the WYSIWYG option, I am back to the same issue.
Hi Alisha,
Can you please share the code that creates the fields on your site? Refer to this documentation to generate PHP code https://docs.metabox.io/extensions/meta-box-builder/#getting-php-code
Here is the code for the WYSIWYG fields that are not saving the p tags:
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Lead Magnets', 'your-text-domain' ),
'id' => 'lead-magnets',
'post_types' => ['resources'],
'context' => 'after_title',
'fields' => [
[
'name' => __( 'Funnel Pack Name', 'your-text-domain' ),
'id' => $prefix . 'funnel_pack_name',
'type' => 'text',
],
[
'name' => __( 'Lead Magnet Name', 'your-text-domain' ),
'id' => $prefix . 'lead_magnet_name',
'type' => 'text',
],
[
'name' => __( 'Hero', 'your-text-domain' ),
'id' => $prefix . 'hero',
'type' => 'group',
'fields' => [
[
'name' => __( 'Hero Headline', 'your-text-domain' ),
'id' => $prefix . 'hero_headline',
'type' => 'text',
],
[
'name' => __( 'Lede text', 'your-text-domain' ),
'id' => $prefix . 'lede_text',
'type' => 'wysiwyg',
],
[
'name' => __( 'Button Text', 'your-text-domain' ),
'id' => $prefix . 'button_text',
'type' => 'text',
'std' => 'Send Me My Free Guide',
],
],
],
[
'name' => __( 'Main Content', 'your-text-domain' ),
'id' => $prefix . 'main_content',
'type' => 'group',
'fields' => [
[
'name' => __( 'Secondary Headline', 'your-text-domain' ),
'id' => $prefix . 'secondary_headline',
'type' => 'text',
],
[
'name' => __( 'Body Copy', 'your-text-domain' ),
'id' => $prefix . 'body_copy',
'type' => 'wysiwyg',
],
[
'name' => __( 'Bullet Point 1', 'your-text-domain' ),
'id' => $prefix . 'bullet_point_1',
'type' => 'text',
],
[
'name' => __( 'Bullet Point 2', 'your-text-domain' ),
'id' => $prefix . 'bullet_point_2',
'type' => 'text',
],
[
'name' => __( 'Bullet Point 3', 'your-text-domain' ),
'id' => $prefix . 'bullet_point_3',
'type' => 'text',
],
[
'name' => __( 'Bullet Point 4', 'your-text-domain' ),
'id' => $prefix . 'bullet_point_4',
'type' => 'text',
],
[
'name' => __( 'Bullet Point 5', 'your-text-domain' ),
'id' => $prefix . 'bullet_point_5',
'type' => 'text',
],
[
'name' => __( 'Bullet Point 6', 'your-text-domain' ),
'id' => $prefix . 'bullet_point_6',
'type' => 'text',
],
],
],
[
'name' => __( 'Popup', 'your-text-domain' ),
'id' => $prefix . 'popup',
'type' => 'group',
'fields' => [
[
'name' => __( 'Popup Headline', 'your-text-domain' ),
'id' => $prefix . 'popup_headline',
'type' => 'text',
],
[
'name' => __( 'Popup Lede', 'your-text-domain' ),
'id' => $prefix . 'popup_lede',
'type' => 'wysiwyg',
],
],
],
[
'name' => __( 'Cover Image', 'your-text-domain' ),
'id' => $prefix . 'cover_image',
'type' => 'image_advanced',
],
[
'name' => __( 'Fluent Form Data', 'your-text-domain' ),
'id' => $prefix . 'fluent_form_data',
'type' => 'text',
'desc' => __( 'Enter the unique slug for this lead magnet request.', 'your-text-domain' ),
],
],
];
return $meta_boxes;
}
Here is the code for the WYSIWYG field that is completely broken:
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'FAQ', 'your-text-domain' ),
'id' => 'faq',
'post_types' => ['faqs'],
'fields' => [
[
'name' => __( 'FAQ: Answer', 'your-text-domain' ),
'id' => $prefix . 'faq:_answer',
'type' => 'wysiwyg',
],
],
];
return $meta_boxes;
}
Hi,
Thanks for your additional information.
wysiwyg
field under the post type resources
, I see that issue. The wysiwyg
field is not working properly as a subfield in a group. I will inform the development team to check and fix this.Regarding the wysiwyg
field under the post type faq
, the field ID must not include the special characters. Should be only numbers, letters, and underscores (and rarely dashes).
[
'name' => __( 'FAQ: Answer', 'your-text-domain' ),
'id' => $prefix . 'faq_answer',
'type' => 'wysiwyg',
]
Refer to this documentation https://docs.metabox.io/field-settings/#general
I was able to fix the issue with the wysiwyg field under the faq post type. Hopefully there will be a fix quickly for the wysiwyg field as a subfiled in a group. Thank you!
I have the same error. Usually I could solve this by clicking "Save data in the raw format", but that doesn't work anymore.
Bricks Builder always inserts an empty <p> tag at the beginning and end.
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Single Post', 'your-text-domain' ),
'id' => 'single-post',
'post_types' => ['service', 'post', 'prozess'],
'fields' => [
[
'name' => __( 'Single Post Sections', 'your-text-domain' ),
'id' => $prefix . 'single-post-sections',
'type' => 'group',
'clone' => true,
'sort_clone' => true,
'fields' => [
[
'name' => __( 'Template', 'your-text-domain' ),
'id' => $prefix . 'template-sections',
'type' => 'select',
'options' => [
'grauebox-section' => __( 'Graue Box', 'your-text-domain' ),
'standard-content' => __( 'Standard Box', 'your-text-domain' ),
'pdf-section' => __( 'PDF', 'your-text-domain' ),
],
],
[
'name' => __( 'Graue Box', 'your-text-domain' ),
'id' => $prefix . 'grauebox-section',
'type' => 'group',
'collapsible' => true,
'fields' => [
[
'name' => __( 'Heading', 'your-text-domain' ),
'id' => $prefix . 'heading',
'type' => 'text',
],
[
'name' => __( 'Subheading', 'your-text-domain' ),
'id' => $prefix . 'subheading',
'type' => 'text',
],
[
'name' => __( 'Wysiwyg', 'your-text-domain' ),
'id' => $prefix . 'wysiwyg_grauebox',
'type' => 'wysiwyg',
'options' => [
'media_buttons' => false,
],
],
[
'name' => __( 'Fußzeile', 'your-text-domain' ),
'id' => $prefix . 'fusszeile',
'type' => 'textarea',
'rows' => 6,
],
],
'visible' => [
'when' => [['template-sections', '=', 'grauebox-section']],
'relation' => 'or',
],
],
[
'name' => __( 'Standard Content', 'your-text-domain' ),
'id' => $prefix . 'standard-content',
'type' => 'group',
'collapsible' => true,
'fields' => [
[
'name' => __( 'Wysiwyg', 'your-text-domain' ),
'id' => $prefix . 'wysiwyg_standard',
'type' => 'wysiwyg',
'options' => [
'media_buttons' => false,
],
],
],
'visible' => [
'when' => [['template-sections', '=', 'standard-content']],
'relation' => 'or',
],
],
[
'name' => __( 'PDF', 'your-text-domain' ),
'id' => $prefix . 'pdf-section',
'type' => 'group',
'collapsible' => true,
'fields' => [
[
'name' => __( 'Text', 'your-text-domain' ),
'id' => $prefix . 'text_pdf',
'type' => 'text',
],
[
'name' => __( 'Button Text', 'your-text-domain' ),
'id' => $prefix . 'button_text_pdf',
'type' => 'text',
],
[
'name' => __( 'File Advanced', 'your-text-domain' ),
'id' => $prefix . 'file_advanced_pdf',
'type' => 'file_advanced',
'max_file_uploads' => 1,
],
],
'visible' => [
'when' => [['template-sections', '=', 'pdf-section']],
'relation' => 'or',
],
],
],
],
],
];
return $meta_boxes;
}
Hope you can Help! Thanks
Tobias
The wysiwyg field is not working properly as a subfield in a group.
have you solved this problem?
Okay it's fixed in Bricks 1.7 Beta.
Thanks for the update, Tobias!!
The wysiwyg field is not working properly as a subfield in a group.
In Oxygen Builder not solved!
When is this solved?
Is this fixed yet ?
i am using AIO to create wysiwyg blocks. they are not under groups but in tabs. the visual editor works as expected but when switched to the text editor, the editor becomes non-clickable and nothing can by typed in it anymore.
Metabox: 5.8.1
AIO : 1.23.1
Wordpress : 6.3.1
the generated php code is as follows
<?php
add_filter( 'rwmb_meta_boxes', 'qualiv_reports_constructions' );
function qualiv_reports_constructions( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Report Single - Construction - Content', 'qualiv' ),
'id' => 'report-single-content',
'post_types' => ['reports'],
'include' => [
'relation' => 'OR',
'report-layout' => [30],
],
'tabs' => [
'main' => [
'label' => 'Main',
'icon' => '',
],
'collaborators-tab' => [
'label' => 'Collaborators',
'icon' => '',
],
'split_content_tab' => [
'label' => 'Split Content',
'icon' => '',
],
'timeline_tab' => [
'label' => 'Timeline',
'icon' => '',
],
],
'fields' => [
[
'name' => __( 'Info Table', 'qualiv' ),
'id' => $prefix . 'info_table',
'type' => 'group',
'collapsible' => true,
'group_title' => '{label}',
'clone' => true,
'sort_clone' => true,
'fields' => [
[
'name' => __( 'Label', 'qualiv' ),
'id' => $prefix . 'label',
'type' => 'text',
'columns' => 4,
'datalist' => [
'id' => '65224c4e372c9',
'options' => [
'Address
',
'Size of Plot
',
'Construction Volume
',
'Timeline',
],
],
],
[
'name' => __( 'Content', 'qualiv' ),
'id' => $prefix . 'content',
'type' => 'textarea',
'rows' => 2,
'columns' => 8,
],
],
'tab' => 'main',
],
[
'name' => __( 'Collaborators Title', 'qualiv' ),
'id' => $prefix . 'collaborators_title',
'type' => 'text',
'std' => 'Collaborators',
'save_field' => false,
'tab' => 'collaborators-tab',
],
[
'name' => __( 'Collaborators', 'qualiv' ),
'id' => $prefix . 'collaborators_carousel',
'type' => 'image_advanced',
'tab' => 'collaborators-tab',
],
[
'name' => __( 'Left Block', 'qualiv' ),
'id' => $prefix . 'left_side_description',
'type' => 'wysiwyg',
'options' => [
'textarea_rows' => 8,
'media_buttons' => false,
],
'sanitize_callback' => 'none',
'tab' => 'split_content_tab',
],
[
'name' => __( 'Right Block', 'qualiv' ),
'id' => $prefix . 'right_side_description',
'type' => 'wysiwyg',
'options' => [
'textarea_rows' => 8,
'media_buttons' => false,
],
'sanitize_callback' => 'none',
'tab' => 'split_content_tab',
],
[
'name' => __( 'Timeline Title', 'qualiv' ),
'id' => $prefix . 'timeline_title',
'type' => 'text',
'std' => 'Timeline',
'columns' => 6,
'save_field' => false,
'tab' => 'timeline_tab',
],
[
'name' => __( 'Timeline Image', 'qualiv' ),
'id' => $prefix . 'timeline_image',
'type' => 'single_image',
'columns' => 6,
'tab' => 'timeline_tab',
],
],
];
return $meta_boxes;
}