Skip Navigation

[Resolved] Updating a Multi-Line field?

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 0 replies, has 1 voice.

Last updated by catherineK 2 months, 4 weeks ago.

Author
Posts
#2680457

Apologies, this is one of those things that I'm sure I'm missing the forest for the trees and working way too hard on, but I'm stumped.

I have a Multiple Lines field:

line 1
line 2

I'd like to update it programmatically in a PHP function, adding a newline character and some text, to get this result:

line 1
line 2
line 3

update_post_meta strips backslashes, resulting in:

line 1
line 2nline 3

How do I do this correctly?

#2680458

Found this info:

PHP will only evaluate escape sequences if the string is enclosed in double quotes. If you use '\n', PHP will just take that as a literal string. If you use "\n", PHP will parse the string for variables and escape sequences and print a new line like you are expecting.

So, there it is.

catherineK confirmed that the issue was resolved on 2024-01-29 17:27:15.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.