When creating a blog post through the WYSIWYG editor, text is not being wrapped in <p> tags correctly when starting with a link
When creating a new blog post, and the first item is a link follewed by text like this:
<a>Some link</a> some text
When this is rendered into HTML The
tags get placed at the end of the text like this:
<a>Some link</a> some text<p></p>
If there is any text before the link at the beginning then
tags are wrapped correctly.
I have gone into wp-includes/formatting.php and am not able to find source of this problem...
Any insight or suggestions would be greatly appreciated. Thanks.
Solutions
May this will helpful for you
1) There will be no p tag will wrap while starting with anchor tag. The editor will takes a each paragraph in a
paragraph tag
.(Whether it may any tag, the editor will all the html content inside of p tag)
2) If you are using wordpress default post editor means just print it by using the_content() or get_the_content($post_id) .
3) If you are using Custom Field (ACF) means use apply_filters().
<?php echo apply_filters('the_content', 'your_field_name');?>
Similar questions
The content not wrapped in paragraph tags with get_page_by_title()
I am using $page = get_page_by_title('name'); to get the contents of a page. When I echo $page->post_content; none of the content is wrapped in p tags like it is when run threw the normal wordpress loop using the_content(). Is there a different way I should get this data so it will contain the proper tags?
Disable WYSIWYG rich text editor only on post excerpt
I am pulling info from the excerpt of a custom post type into a 3rd party application. I need to be able to add line breaks and for them to be saved in the database. If my user switches to "visual" from "text" and saves the post, the tags are stripped out. My solution was to disable the use of the rich text editor for my custom post type. Solution ...
How to use square brackets in a WYSIWYG editor to post-process text?
I need to obfuscate email addresses before they are published on my users' sites, to prevent spambots from scraping them. However, some users like to use mailto links (against my advice, but they do what they will), and my obfuscation function breaks the mailtos. So I'd like to make it easy for site admins to slap obfuscation around some email addr...
How to remove p tags around img and iframe tags in the acf wysiwyg field
I am querying an advanced custom fields wysiwyg field. Problem is in the output wordpress wraps occasional imgs and iframes with p tags no matter what i try. Deactivate the wpautop works remove_filter ('acf_the_content', 'wpautop');but if i try to exclude only imgs and iframes with the following snippet it fails: Does anyone have a suggestion how t...
Creating html5 placeholder from form label when input is wrapped in a div
I'm using Gravity Forms and need to use the label as placeholder text. There are a couple of WordPress plugins but they don't always work. I also found a solution that added a placeholder field in the Gravity Forms form builder but I don't really need that. What I'm trying to do is use jQuery to get the label text and assign that text as the placeh...
Also ask