I have created a custom field with a WYSIWYG editor for a particular page that I also want to see in a different page. When I get_field() it in the post it was created the output is perfect, but when I try to pull it in from a different post the output has not a single <p>, which completely messes up my styles.
Here’s what it looks like from the post it was generated:
string '<h1>heading 1</h1>
<p>This is the first paragraph of this wysiwyg test.</p>
<p>This is the second paragraph of the wysiwyg test.</p>
And when in a different post:
$custom = get_post_custom(33);
produces the following output
0 => string '<h1>heading 1</h1>
This is the first paragraph of this wysiwyg test.
This is the second paragraph of the wysiwyg test.
As you can see, there aren’t <p>s on the second case. Why does this happen? Is there a way around it? Any help would be much appreciated.
I actually managed to solve it at the end.
For some reason the way I was coding the call was only echoing content of the paragraphs. When I just simply did what is written in the documentation: get_field('key-of-the-field', ID-of-the-post);
it pulled all the <p> tags…
Box ticked! (and hopefully someone else will find this useful)
Viewing 2 posts - 1 through 2 (of 2 total)
The topic ‘No 'p' tags on WYSIWYG output when querying from different post’ 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
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future. https://t.co/HahJUCcyH4