
I just tested this on a site with only ACF and WP, I tested with both ACF4 and ACF5. I’m not getting this error. Have you tried deactivating plugins or changing themes?
Are the WYSIWYG fields at the top level or are they in a repeater or something? What are the settings for the fields. If you give me some more information I’ll try more testing if I am able to. I don’t have the flex field for ACF 4 though so I can only go so far with that.

I just tested this on a site with only ACF and WP, I tested with both ACF4 and ACF5. I’m not getting this error. Have you tried deactivating plugins or changing themes?
Are the WYSIWYG fields at the top level or are they in a repeater or something? What are the settings for the fields. If you give me some more information I’ll try more testing if I am able to. I don’t have the flex field for ACF 4 though so I can only go so far with that.

Witt the optimization built into MySQL and the WP tables (all having proper indexes) for performing the queries that are done, there really should be little effect on the speed of a site based on the database size. I’m not sure where you heard that it would. I have some sites with huge databases and as many as 100 fields on some post types using flexible content fields and repeaters with no performance issues on the front end. On one site there is a repeater field and each of these repeaters can have up to 7 WYSIWYG editors and associated fields for a total of about 70 fields per repeater and there is not limit to the repeaters. There are as many as 20 of these repeaters on some posts for a possible total of over 1000 fields. Like I said, I don’t see any performance issues on the front end. If there is any performance loss then it is undetectable.
On the other hand, a search using the standard WP search that does a %LIKE% query for every word in a search request on 100K+ posts…. that’s going to die, and this has nothing to do with ACF. There is no index on “Content” fields in the database. I would suggest that you look for a different way to do site searches on a site this size.
If you do a searches and do some research on it you will find that MySQL does not see performance issues on large databases when the tables are indexed properly.
The back end is a different story entirely, and this really doesn’t have anything to do with ACF, but with the way that WP handles updating the post meta values…. one at a time. ACF simply uses what WP makes available. You would see the same problem whether you use ACF or custom build the custom fields yourself. Because of this, too many fields being submitted on a single admin page will likely cause you issues. That site I mentioned above with the more than 1000 fields on a post, those posts time out when hitting update, why, because WP does more than 3000 queries to update those fields (agian, WP, not ACF), and that does not include the field_key queries. Like I said, nothing to do with ACF. If I had built all these fields myself the result would be the same. That site was built a while ago and since that one I am extremely careful about how many fields I build into a single admin page. When I see that the number will be high I find an alternate way to do so, for example, creating multiple edit pages. I could have, for example, instead of using a repeater field in this case I could have created a hierarchical post type where the “Repeaters” were actually child pages. Although this would have more of an effect on front end performance because it would mean querying for those child pages.
Hope that helps.
+1
I am also having this issue. The first WYSIWYG area displays correctly, but the the ones following after that do not display because of the JS error.
Error: Uncaught TypeError: Cannot read property ‘body’ of undefined
Line: wp-tinymce.php?c=1&ver=4401-20160726:12
Stack Trace
getBody @ wp-tinymce.php?c=1&ver=4401-20160726:12
add_events @ input.min.js?ver=4.4.8:2
init @ input.min.js?ver=4.4.8:2
(anonymous function) @ input.min.js?ver=4.4.8:2
each @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,wp-a11…:2
each @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,wp-a11…:2
(anonymous function) @ input.min.js?ver=4.4.8:2
Having the same Issues. Just pitched the client to move away from Visual Composer for speed issues and now ACF Flexible Content with repeating WYSIWYG is causing 502 on post update hook.
Thanks John – however, a detailed solution came through (which I think you were pointing me towards) from James on [email protected] which does exactly what I want. Code is (to put in [theme]/functions.php) :
function my_acf_load_value( $value, $post_id, $field ) {
$content = apply_filters('the_content',$value);
$content = force_balance_tags( $content );
$content = preg_replace( '#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content );
$content = preg_replace( '~\s?<p>(\s| )+</p>\s?~', '', $content );
return $content;
}
add_filter('acf/load_value/type=wysiwyg', 'my_acf_load_value', 10, 3);
No more empty <p> tags in ACF Wysisyg fields!

You could add a filter to remove them, there is an example here for WP and this could easily be adapted to ACf using an acf/format_value filter for wysiwyg fields https://www.advancedcustomfields.com/resources/acfformat_value/

It could have something to do with the order that the filters are run. ACF does run shortcodes on wysiwyg fields.
Since it appears that your filter is altering the content of the shortcode before it is run, it could be that the shorcode is run before your filter. You could try setting a high priority on the filter for ACF to make the changes before ACF runs the rest of the content filters.
add_filter("acf_the_content", "the_shortcode_filter", 1);

ACF does not run ‘the_content’ on wysiwyg fields. Add a second filter
function the_shortcode_filter($content) {
$block = join("|",array("columns", "first", "second", "block-bullets", "loan-terms-from"));
$rep = preg_replace("/()?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);
$rep = preg_replace("/()?\[\/($block)](<\/p>|<br \/>)?/","[/$2]",$rep);
return $rep;
}
add_filter("the_content", "the_shortcode_filter");
add_filter("acf_the_content", "the_shortcode_filter");

Hi @mayte
I don’t have Gravity form, so I can’t test it myself. Please forgive me if I can’t help you much.
Could you please check if it happens if you use it without the WYSIWYG field? Maybe Gravity form needs to add additional scripts or execute something that’s not executed by ACF’s WYSIWYG field. Here are the filters used by the WYSIWYG field:
add_filter( 'acf_the_content', 'capital_P_dangit', 11 );
add_filter( 'acf_the_content', 'wptexturize' );
add_filter( 'acf_the_content', 'convert_smilies' );
add_filter( 'acf_the_content', 'convert_chars' ); // not found in WP 4.4
add_filter( 'acf_the_content', 'wpautop' );
add_filter( 'acf_the_content', 'shortcode_unautop' );
add_filter( 'acf_the_content', 'do_shortcode', 11);
Could you please ask the Gravity form’s support regarding this issue?
Thanks 🙂

Hi @rshmiraf
For WYSIWYG field, I believe you can do it like this:
add_filter('acf/validate_value/name=wysiwyg_field_name', 'my_acf_validate_value', 10, 4);
function my_acf_validate_value( $valid, $value, $field, $input ){
// bail early if value is already invalid
if( !$valid ) {
return $valid;
}
if( strlen($value) > 40 ) {
$valid = 'You can\'t enter more that 40 chars';
}
// return
return $valid;
}
If still no joy, could you please share the code you have?
Thanks 🙂
Hey @jolora
This thread is a bit old but I thought I’d jump in. I’m using the Easy Footnotes plugin and was having the same problem you were having with Civil Footnotes. Your solution works (thank you!), but there’s a wrinkle…I’ve got multiple ACF WYSIWYG fields on my pages, and the footnotes are being output at the bottom of each one of them. So I’m seeing lots of repeating and redundant footnotes throughout the page content. What I need is to output the footnotes just once at the very bottom of the page, below all the content. Any ideas? Thanks in advance.

If it’s a bug, unless you can recreate it and tell me how, it will be hard to fix.
Other than a bug, could you have accidentally had two fields with the same name in the layout? One of which was an wysiwyg editor and the other anything that returns an array, like a checkbox, multiselect, relationship type fields? This could cause it, especially if the wysywig is before the other field.
Hi James,
I tried this but without result. This field is wysiwyg editor end text field. Could you share me example with code / option which limit word character for example 40 chars.

Hi @harrykc
The WYSIWYG field can support shortcode because it will implement the do_shortcode() function when the value is returned. Shortcodes are officially used by WordPress and other plugins, so ACF is supporting it.
The problem with the tag is that NextGEN will only watch the post content for its tag and apply a function to it. Unfortunately, ACF doesn’t know which function it’s. Even if I check their code, it will be hard for me to find it and apply it correctly. That’s why asking them regarding this topic would be a better choice for you as they are the one who know their code.
I hope this makes sense 🙂
Thanks James,
The WYSIWYG field can support shortcode of NextGEN gallery. But this is hard to use of shortcode for normal user instead of use “Add gallery” button.
If ACF can support new NextGen tag will be much appreciated.

Hi @harrykc
It seems that NextGEN modifies the content automatically, but it doesn’t know anything about ACF’s fields. Could you please ask NextGEN support if there’s a function to generate the gallery manually? That way you can do it to the returned data from the WYSIWYG field.
I hope this helps 🙂

This is only the case in ACF4. ACF 5 (Pro) uses the WP editor and includes them. This change has not made it into ACF 4 and the feature cannot be added. ACF 4 uses a different method of adding the WYSIWYG editor.
To close this thread off.
I tracked down my original issue with WYSIWYG fields not working. It was because I was using a function to re-order fields via prepend which was the culprit to ‘breaking’ the WYSIWYG fields.
Thanks again @hube2 for your support. The links you sent helped with other areas of my code.

Hi @toad78
It seems that the value is returned as a wrong format. Did you set the “Return Value” to any other than “Image Array”? Could you please var_dump() the value like this:
var_dump( get_field('widget_background_image', 'widget_wysiwyg_widgets_widget-11') );
Thanks 🙂
Warning: Illegal string offset ‘url’ in /home/…/public_html/…/…/…/wp-content/themes/…/functions.php on line 143
$backgroundimage = get_field('widget_background_image', 'widget_wysiwyg_widgets_widget-11');
register_sidebar( array(
'name' => __( 'Widgets', 'tempestcorp' ),
'id' => 'page-widget',
'description' => __( 'Appears on any of the assigned pages.', 'tempestcorp' ),
'before_widget' => '<section id="%1$s" class="widget %2$s" style="background-image: url(' . $backgroundimage['url'] . ');">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );

Hi @darktakua
Please learn how a theme works here: https://codex.wordpress.org/Theme_Development.
The code is used to check if the custom field (in this case “rep_last_name”) has a value or not. If it has a value, it should be safe to assume that the rep card has a content, right? Then if the rep card has a content, show the rep card layout and the other custom fields’ value.
The code is ended by a span tag because I followed the code in your screenshot. But I didn’t notice that the code is not ended there. I’m sorry for the confusion.
A shortcode is a code that you can use in the WYSIWYG content that allows you to execute the PHP code associated with it. This page should give you more idea about it: https://codex.wordpress.org/Shortcode.
If you don’t have time to learn how WordPress template works, I suggest you hire a developer to help you out with it, and I’d recommend looking for one on https://studio.envato.com/ or https://www.upwork.com/.
I hope this helps 🙂
Hi James!
Sorry but im no step further. When i use the code like posted above on my website:
<?php
acf_form(array(
'post_id' => 'new_post',
'post_title' => true,
'post_content' => true,
'new_post' => array(
'post_type' => 'contact_form',
'post_status' => 'publish'
),
'return' => home_url('contact-form-thank-you'),
'submit_value' => 'Send'
));
?>
I just get a form with a title and a wysiwyg-box. The form i need should have at least the fields user-firstname, user-lastname and some custom fields i added to the users.
Sorry but i really have no idea how to create that. Should i give you access to my wp backend?
Thanks Pascal
Hi,
I can’t reproduce the problem now, so I think maybe it’s a side effect…
My code is quite simple :
if( function_exists('acf_add_local_field_group') ):
// Woocommerce : Product page fields
acf_add_local_field_group(array (
'key' => 'group_575eadb687a13',
'title' => 'PRODUCT INFORMATIONS',
'fields' => array (
array (
'key' => 'field_575eadcca9ddd',
'label' => '3 Instagram Photos',
'name' => 'three_instagram_photos',
'type' => 'gallery',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'min' => '',
'max' => 3,
'preview_size' => 'medium',
'insert' => 'append',
'library' => 'all',
'min_width' => '',
'min_height' => '',
'min_size' => '',
'max_width' => '',
'max_height' => '',
'max_size' => '',
'mime_types' => '',
),
array (
'key' => 'field_57682747afc89',
'label' => 'External video',
'name' => 'external_video',
'type' => 'oembed',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'width' => '',
'height' => '',
),
array (
'key' => 'field_57714db3280c7',
'label' => 'More description',
'name' => 'more_description',
'type' => 'wysiwyg',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'tabs' => 'all',
'toolbar' => 'full',
'media_upload' => 1,
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'product',
),
),
),
'menu_order' => 0,
'position' => 'acf_after_title',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
...

Thanks for the bug report.
I believe this issue is caused by the way WPML add’s it’s language switcher to the taxonomy edit page.
Instead of appending a ‘tr’ element, it clones the last ‘tr’ elmeent in the table.
In your case, this last element is a WYSIWYG field.
In cloning this field, WPML is causing ACF to initialize a WYSIWYG field on an element which does not exist.
Can you please contact WPML and ask them to look into this issue?
It would solve the problem completely if they added a standard ‘tr’ element, not cloning the last element.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.