All shortcodes should be run in wysiwyg fields by default, so we’re back to your original problem. The shortcodes should be working without adding any code.
Try changing “textarea” to “wysiwyg”
add_filter('acf/format_value/type=wysiwyg', 'my_acf_format_value', 10, 3);
what version of ACF are you using?
Right again, John
The field I am trying to add the shortcode to is defined as WYSIWYG Editor (German translation). Want me to replace “textarea” with “wysiwyg editor” (or look up the correct english expression.
Thank you again.
Hi @infoamitywebsolutions-co-uk
ACF actually makes use of a similar filter to fetch the ACF data this is the acf_the_content filter.
This controls the output from the ACF WYSIWYG field and you can use the filter to format the value.
Hey people. I was reading through the latest changelogs and it seems a fix has been release to alleviate this issue. Not sure if it would fix it (I can’t validate right now on the website that was causing the issue for me). Maybe validate? https://www.advancedcustomfields.com/blog/acf-pro-5-5-0-update/ (WYSIWYG delay option)
Having a similar issue with v 5.5.2. I have the following setup:
Flexible Content Field
– Repeater Field
— WYSIWYG Field
When I save the page, the WYSIWYG field is blank. If I move the WYSIWYG field out of the repeater, then the content saves for some reason.
** Reverting to v5.3.9.2 has fixed the issue.
They’re wysiwyg fields within flex fields. I think the data is still being stored, it just loads an empty editor in admin and displays all my code around my loops on the templates without showing what’s in them
What type of fields are we talking about, other than it being a wysiwyg field. Are these fields sub fields in a repeater or a flex field?
Hi @permanyer
I’ve just checked it again using WPML and it seems that WPML is duplicating the last ‘tr’ element on the page and adding it’s meta box (language switcher).
The problem is that this duplicated tr contains all the ACF classes, so ACF thinks it is a WYSIWYG field. This is why the JS fails.
Can you please contact WPML and let them know that they should use a clean ‘<tr>’ element to avoid conflicts with 3rd party plugins. ACF is not the only plugin that appends extra form inputs to the category edit page, so it would be in WPML’s best interest to fix the issue from their end.
I hope this makes sense 🙂
Hi @moettinger
You should be able to export the JSON file from “Custom Fields > Tools”.
Also, it seems your WYSIWYG field somehow has the Show Media Upload Buttons? set to empty, which makes ACF thinks that it’s set to false.
To fix it, could you please expand/open all WYSIWYG fields in your flexible content field on the field group editor page and then resave it. You don’t need to change anything, though.
Hope this helps 🙂
My biggest issue is during the image upload process. My current implementation is as follows:
Flexible Field
– Layout
— Flexible Field
— WYSIWYG
— Image Upload
— Plain Text
The Layouts are 1,2,3,4 columns etc… so each column could use WYSIWYG, image or plain text options.
Right now I have ACF PRO 5.4.8, am using @hube2 Reusable Field Groups plugin along with some others that I’ve included in the below zip.
So far I’ve switched WYSIWYG to text tab default (trying @3pointross plugin :), switched from using image object to ID, use no conditionals in the front end. Around image number 5 being added to a column row, I get exceptional page lag.
I completely understand limiting the complexity of flex content fields, but really want ACF to work as it’s a great plugin @elliot
UPDATE Have to abandon ACF on a current client site. They experience timeouts when creating rows. I’d love a concrete solution here, but Beaver Builder is going to have to replace for this project.
Same issue here. Using flexible content field with ability for user to select number of columns where each column editor will show its own WYSIWYG. In random columns, the media upload button is missing.
I posted this on another thread, but in the interest of helping others out and getting some feedback I’ll post here as well…
I’ve run into a similar issue specifically with JS performance and multiple TinyMCE elements. I’ve been working on a fix that I’d love some help testing.
Like many of you I end up with sites that have a TinyMCE field in a repeater or flexible content widget. If the client ends up adding more rows than expected the performance degrades quickly.
So I built an add-on field that lazy loads the TinyMCE editor when someone wants to edit the content of the field. That way only one TinyMCE instance is active at a given time and performance improves significantly.
I’ve used it in a few places and it currently supports both ACF4 and ACF5, but I’d love to get more people using it to see if I’ve missed anything.
You can download and try it out here https://github.com/3pointross/ACF-Lite-WYSIWYG
Any feedback would be great.
I’ve run into a similar issue specifically with JS performance and multiple TinyMCE elements. I’ve been working on a fix that I’d love some help testing.
Like many of you I end up with sites that have a TinyMCE field in a repeater or flexible content widget. If the client ends up adding more rows than expected the performance degrades quickly.
So I built an add-on field that lazy loads the TinyMCE editor when someone wants to edit the content of the field. That way only one TinyMCE instance is active at a given time and performance improves significantly.
I’ve used it in a few places and it currently supports both ACF4 and ACF5, but I’d love to get more people using it to see if I’ve missed anything.
You can download and try it out here https://github.com/3pointross/ACF-Lite-WYSIWYG
Any feedback would be great.
While it’s probably a good idea as an example, that is a plugin for tinyMCE and woven into the WP content editor.
You need to somehow extract this and add some more code since this form passes the results back to the WYSIWYG and you’d need it to pass results back to the field in question, or simply build it as part of the field settings.
You also need to remember that ACF only stores a single value for a “page link” field. An interface like this would require storing an array that includes, at a minimum url and open in new tab values, possibly the link text if you want to allow them to supply that. A field that allows these things would require a new field type because none of the available field types store the value in a way that would be compatible with this.
If you attached something like this to the current URL field, and did not supply the “open in new window” option, then you would only be able to store the URL and eventually you’d have people asking “can you add an option to open it in a new window”… and then the inevitable “can you add a way to browse to external links to select them”. Granted, that last one is pie in the sky, but I’ve had clients ask be why they can’t do that with the one built into WP.
I am probably over simplifying it, but the default insert/edit link
option that is also available in the WYSIWYG editor seems like the perfect solution. It would be great to use this because clients are already familiar with this interface (see screenshot).
If I want to wrap this in a button I have to give them a different UI to accomplice the same thing. First a checkbox do you want a button? Next do you want a external or internal button? Than the button title, button url and if it should open in a new tab or not, all this is all caught in the simple interface that WordPress is already providing.
This is just a guess, so I’m not sure if it will do you any good. Basically you need to alter the widget arguments for ‘before_widget’ and ‘after_widget’ based on the custom field. Like most widgets, where are no hooks in the widget itself to make these changes https://plugins.svn.wordpress.org/wysiwyg-widgets/trunk/includes/class-widget.php.
The closest I’ve been able to find is this WP hook https://developer.wordpress.org/reference/hooks/dynamic_sidebar_params/. From looking at it I’m guessing that $params contains information on all of the widgets that are in the sidebar, but again, this is just a guess. If the guess is correct you could loop through all of the widgets, find the right ones, get your custom field value and then modify the before and after widget arguments to include your container div with the background image.
Hi John,
Thanks for responding so quickly! I totally understand, I think I need to figure out a new approach.
One angle I’ve thought of is adding the same class to every link that is outputted by the WYSIWYG editor. Is that possible? So say on the front-end every link looked like:
<a href="blahblah" class="scroll-to-link"></a>
I’ve had a look through the TinyMCE documentation but everything seems to be weighted towards styling the editor – I haven’t come across anything that would help me add a class.
Thanks!
Hi @James!
Thanks to return! 🙂
Well, let’s go to the explanation:
We have the “specific Follow up” that works perfectly.
I want the “Follow specific ups” of each “Phase” appears in the “Follow up General”. On here:
The code for the “general Follow up” appears is in my question above, but not given any returns.
Below forward you the JSON export area of my group camps, which already includes the “Phases” and “Follow ups”:
$phase_fields = array (
'id' => 'acf_phases',
'title' => __('Phases','psp_projects'),
'fields' => array (
array (
'key' => 'field_5436e7cae06b2',
'label' => __('Break projects into multiple phases with specific tasks.','psp_projects'),
'name' => '',
'type' => 'message'
),
array (
'key' => 'field_527d5dc12fa29',
'label' => __('Phases','psp_projects'),
'name' => 'phases',
'type' => 'repeater',
'sub_fields' => array (
array (
'key' => 'field_527d5dd02fa2a',
'label' => __('Title','psp_projects'),
'name' => 'title',
'type' => 'text',
'column_width' => '',
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'html',
'maxlength' => '',
),
array (
'key' => 'field_527d5dea2fa2c',
'label' => __('Description','psp_projects'),
'name' => 'description',
'type' => 'wysiwyg',
'column_width' => '90',
'default_value' => '',
'toolbar' => 'full',
'media_upload' => 'no',
),
//START FOLLOW UP
array (
'key' => 'field_57c8e3d4d2c8d',
'label' => __('Follow up','psp_projects'),
'name' => 'follow_up',
'type' => 'repeater',
'instructions' => 'Insira aqui as informações e detalhamento em relação a este projeto.',
'column_width' => '',
'sub_fields' => array (
array (
'key' => 'field_57c8e41bd2c8e',
'label' => __('Data de atualização','psp_projects'),
'name' => 'data_de_atualização',
'type' => 'date_picker',
'date_format' => 'yymmdd',
'display_format' => $date_format,
'first_day' => 0,
),
array (
'key' => 'field_57c8e4d9d2c8f',
'label' => __('Nº do processo','psp_projects'),
'name' => 'n_do_processo',
'type' => 'text',
'column_width' => '',
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'html',
'maxlength' => '',
),
array (
'key' => 'field_57c8e4f9d2c90',
'label' => __('Unidade','psp_projects'),
'name' => 'unidade',
'type' => 'text',
'column_width' => '',
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'html',
'maxlength' => '',
),
array (
'key' => 'field_57c8e50ad2c91',
'label' => __('Desde','psp_projects'),
'name' => 'desde',
'type' => 'date_picker',
'date_format' => 'yymmdd',
'display_format' => $date_format,
'first_day' => 0,
),
array (
'key' => 'field_57c8e523d2c92',
'label' => __('Situação','psp_projects'),
'name' => 'situacao',
'type' => 'text',
'instructions' => 'Ex.: "INFORMANDO BOLETIM DE DADOS TÉCNICOS"',
'column_width' => '',
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'html',
'maxlength' => '',
),
array (
'key' => 'field_57c8e54ed2c93',
'label' => __('Detalhamento Kallas','psp_projects'),
'name' => 'detalhamento_kallas',
'type' => 'textarea',
'instructions' => 'Ex.: "Estão sendo informados zoneamento, largura e classificação viárias, gabarito e outros dados para prosseguir posteriormente para análise técnica"',
'column_width' => '',
'default_value' => '',
'new_lines' => 'wpautop',
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'html',
'maxlength' => '',
),
'row_min' => '',
'row_limit' => '',
'layout' => 'row',
'button_label' => __('Adicionar Follow up','psp_projects'),
),
//END FOLLOW UP
),
'row_min' => '',
'row_limit' => '',
'layout' => 'row',
'button_label' => __('Add Phase','psp_projects'),
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'psp_projects',
'order_no' => 0,
'group_no' => 0,
),
),
),
'options' => array (
'position' => 'normal',
'layout' => 'default',
'hide_on_screen' => array (
),
),
'menu_order' => 3,
);
How can we do so that the “Follow up General” to work successfully? Call it as in my question has not worked.
Already, thank you very much for your help. 🙂
Hi,
Not sure if this will work for you, but it worked for me..
//Remove WPAUTOP from ACF TinyMCE Editor
function acf_wysiwyg_remove_wpautop() {
remove_filter('acf_the_content', 'wpautop' );
}
add_action('acf/init', 'acf_wysiwyg_remove_wpautop');
This will remove it from all ACF WYSIWYG fields, but you should be able to target this to just one field..
The difference between this function and the others I saw in this thread, is that the action is added on ‘acf/init’
For more than one year that I look this solution and while it is not a substitute for ACF by Custom Field Suit only for compatibility with Visual Composer in the WYSIWYG editor.
Is there anyone working in this fix?
Hi @mdurchholz
Yes, it would affect all WYSIWYG editor. If you want to do it only for certain field, you can use the acf/load_value filter instead. It should be like this:
function my_acf_load_value( $value, $post_id, $field ) {
remove_filter('acf_the_content', 'wpautop' );
return $value;
}
// acf/load_value/name={$field_name} - filter for a specific value load based on it's field name
add_filter('acf/load_value/name=wysiwyg_editor', 'my_acf_load_value', 10, 3);
I believe the text area field won’t convert special chars like <>
. I’ve just tested it on my installation and it executed the script correctly. Maybe it has something to do with your theme, plugins or database encodings.
To check if it’s your theme or plugins fault, could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.
To check if it’s your database encodings fault, you need to get in touch with your hosting provider.
I hope this makes sense 🙂
Take a look at the WYSIWYG field in ACF. There is some conditional logic in it that only loads the WP uploader where it’s needed. It’s the only field in ACF that I know of that does something like this and probably your best bet at getting an idea of what you’re looking for.
Wouldn’t that script stop all wysiwyg editors? I only want it for one area. Is there a way to modify it to target one specific field group?
Also, is there a way to stop the textarea fields from changing my <> characters into HTML entities? I’d prefer to use the textarea rather than adjusting the WYSIWYG editor.
Hi @mdurchholz
For the text area field, you should be able to set the New Lines option (PRO version) or Formatting option (Free version) to “No Formatting”.
For the WYSIWYG field, you should be able to remove the <p>
tag like this:
function my_acf_add_local_field_groups() {
remove_filter('acf_the_content', 'wpautop' );
}
add_action('acf/init', 'my_acf_add_local_field_groups');
I hope this helps 🙂
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.