ACF PRO 5.5
I have created a new textarea and am trying to set “New Lines” as No Formatting. Every time I hit update/save it reverts back to what ever automatic option was saved previously.
Is this a bug? Or am I doing something wrong here?
Thanks
Hello ralphioooo and John,
I have encountered the same problem on one of my websites where I updated the plugin to version 5.5.0. It is indeed a (severe) bug since saving a field set where a textarea is used resets to the “Automatically add paragraphs” option and it can completely mess up the frontend display or worst when used for e.g. adding JavaScript or CSS to the head of a website which I do on some occasions. Furthermore it may also affect other select type choices in other fields.
Since with the database upgrade rolling back was not an option for me I dived into the code to put in a quick fix myself. I tracked the problem down to the following file after comparing the code to a previous version that did not have this problem:
/advanced-custom-fields-pro/fields/select.php
Around line 269 there used to be an additional couple of lines of code which, when adding them again to the file, solved the problem and the select now has the proper choice active in the WP admin edit screen:
// add empty value (allows ” to be selected)
if( !count($field[‘value’]) ) {
$field[‘value’][”] = ”;
}
I’m not sure if the above piece of code was moved to a different location or rewritten/ replaced by a different piece of code that is apparently currently not working. It makes sense that it should be present because with the code missing it is no longer allowed to have an empty value a valid option.
I hope that a fix will be released soon by you guys so the problem is resolved.
Kind regards,
Ernst Jansen
ByteMotion
This is why there is a big alert that says something like “it is strongly suggested that you back up your database before upgrading”. I’m not the developer, I just help out here, and like I said, I’ve let him know about the issue. But you really should never update anything in WP without making a backup of the site and database first.
Hi guys
Sorry about this bug. Please note this issue is not related to anything in the DB, or related to the DB upgrade.
I’ll be releasing an update later today which will fix the problem in the select field render function
Thanks Elliot, I’m still having an issue with this after the update. It will now save with the no formatting option. But when I try and save a text area with a script it still strips the <script> tags out?
This is on an options page in admin.
Do you have any filters added to your site that call any of the WP kses functions? Scripts is one of the things that these functions removes. I could be missing it but I don’t see anything in ACF that should be causing this. I’ve tried adding a script to a textarea field, even logged in as a contributor, and it’s not being removed.
The topic ‘TextArea – No Formatting not saving for New Lines’ is closed to new replies.
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.