This is similar to a recent ticket I opened but the prior ticket was for termmeta, not custom fields and this broadens the issue to content getting filtered to not have blank lines in general, not just when I was using a method to get the term meta that didn't fully render the content. Christian helped with the prior issue.
I am trying to: Output custom WYSIWYG fields on a WooCommerce Product in a Toolset Layout
Link to a page where the issue can be seen: hidden link
Look in specifications tab.
I expected to see:
Each bolded label and its text on separate lines
Instead, I got:
One long paragraph all wrapped together.
Disable auto paragraphs is not checked. This is in an Elementor gloabal tab widget with a types shortcode for the field inside. I've also tried putting just the field in its own visual editor cell outside of the elementor widget to make sure it wasn't Elementor causing the issue. If I use types_render_field I still get the wrapped text. If I use get_post_meta and wrap it in wpautop, I get what I expected to see. I've look in the database and the line ends are in the content so it is not an issue with the content being stored already wrapped. Even if I use get_post_meta in a shortcode I wrote that gets displayed in the visual editor cell without disable auto paragraphs checked, it comes out wrapped. Something is causing types to not be able to output with auto paragraphs and I can't figure out what the cause is.
If I use types_render_field and run that through wpautop, it still comes out wrapped so the line ends are removed by types_render_field before I get a chance to run it through wpautop.
I've tried disabling all the plugins that I can to see if one of them is adding a filter that is the problem but none seem to be the cause.
I cannot change the theme and obviously cannot disable WooCommerce or Toolset. The remaining factor seems to be Elementor with Toolset. If I put the types shortcode for the field into its own visual editor cell and disable the_content filters, I get the correct output. If I put the Elementor global widget with the tabs in it into a visual editor cell with the same settings, I get the problem output as it seems Elementor calls the_content filters whether the Toolset visual editor cell does or not. But, I'd really like the find the root cause ... which filter from where is doing this so talking the client out of using Elementor's tabs isn't the right solution.
I've checked through the Generatepress theme and haven't found any filter in there that might cause this issue.
Ok so in this case it should give the auto paragraphs.
When did this start happening ? Also have you tried doing a raw output ? By adding the raw attribute to the function ? If the p tags are added then they should get save in the database. As you mentioned the get_post_meta returns the correct results.
Try adding the raw attribute and see if this helps.
Started happening within the last two weeks. Not sure exactly when.
Adding output='raw' doesn't seem to make a difference.
Something is clearly filtering the content but I cannot figure out what. If I turn off the_content filter in a normal Toolset cell, it outputs correctly. But I can't do that when the toolset types shortcode is in an Elementor widget such as the tabs widget because Elementor also calls the_content filters.