The line breaks are stripped off when the p tag has a dir attribute inserted, to explain further I'll list some examples. Let's say we have 2 lines of text as following <p>Text Paragraph Number One Goes Here</p> <p>Text Paragraph Number Two Goes Here</p> If I want to add line breaks between the two paragraphs it works fine to become like: <p>Text Paragraph Number One Goes Here</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>Text Paragraph Number Two Goes Here</p> However if …
I need to remove the "wpautop filter" from my WordPress Website because it is adding too many paragraphs. I'm new to WordPress. I don't know how to create Child themes. The name of my theme is the "supreme directory". is it also possible to remove the "wpautop filter" from the supreme directory theme directly?
How to process the textarea field with the standard WordPress function wpautop() when clicking the button? Here's the form: <textarea id="my_ta">Lorem ipsum!</textarea> <button id="button_processing_ta">Обработать</button> Here's the handler (to function.php): <?php function my_action_javascript() { ?> <script> document.getElementById( 'button_processing_ta' ).addEventListener( 'click', function() { let my_ta = document.getElementById( 'my_ta' ); // ??? wpautop( my_ta.value ); }); </script> <?php } add_action( 'admin_print_footer_scripts', 'my_action_javascript', 99 ); ?> Sorry for my English...
We build a media (based on bootstrap 4 media object) shortcode with the following syntax: [media img="https://via.placeholder.com/64x64.png"]<h5>List-based media object</h5>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.[/media] The function can be found here: add_shortcode( 'media', 'xcore_shortcode_media' ); /** * Media shortcode * * @doc https://getbootstrap.com/docs/4.3/components/media-object/ * * @param $atts * @param null …
Hey guys, I simply want to prevent the creation of empty paragraphs in my wordpress post. That happens quite often when trying to manually space content. I don't know why this doesn't take effect? /*Remove empty paragraph tags from the_content*/ function removeEmptyParagraphs($content) { /*$pattern = "/<p[^>]*><\\/p[^>]*>/"; $content = preg_replace($pattern, '', $content);*/ $content = str_replace("<p></p>","",$content); return $content; } add_filter('the_content', 'removeEmptyParagraphs'); edit/update: seems like the problem is this: function qanda($content) { // filters for [q=some question] and [a=some answer] // wraps it …
I have a shortcode which accepts basic HTML tags as shortcode attribute. When this shortcode is used in the shortcode block i.e within <!-- wp:shortcode --> then unbalanced <p> tags are added to the shortcode attribute. If it is used normally, then no <p> tags are added. Are there any workarounds which can be done to avoid this issue ? function abcd_shortcode( $atts ){ print_r( $atts ); } add_shortcode('abcd', 'abcd_shortcode'); Output (notice the </p> and <p> tags added for no …
After WordPress 4.3, the old method of disabling wpautop no longer works. Has anyone discovered a new method for removing this function? remove_filter( 'the_content', 'wpautop', 99 ); remove_filter( 'the_excerpt', 'wpautop', 99 );
I'm using the remove_filter in functions.php to remove the auto insertion of <p> and <br> tags on my wordpress site. remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); But one of our pages (wiki) is being dynamically created and to make a long story short, it relies on the <p> tags. How and where should I write an if statement that targets only certain pages to apply the remove_filter to? I've tried placing this code in the both the functions.php, …
I am using the Mailchimp plugin, and it has a shortcode that uses output buffering to grab its widget's code and spit it out in the content. However, the widget code has plenty of white space, so the_content filters are throwing useless linebreaks (like after hidden inputs) and empty p tags everywhere... rendering it unusable. I am removing the shortcode to add my own, but I'm not sure what to do to prevent the WordPress wpautop filter from going crazy. …
I am using wp_editor in a custom meta box. It is saving the content to the post metadata. And displaying it in the meta box as it should. The problem is when I am trying to display this content on the public-facing side of the website. It is displaying without the paragraphs. All other HTML that are part of the wp_editor content is displaying as they should. My meta box code is as follows: public static function as_bllp_create_call_to_action_meta_box( $post ){ …
While working on a custom plugin, I needed to add the wp_editor in the admin to let the user add its own content. I want the user to be able to write custom rich texts with the "Visual" editor mode but I also want the user to be able to paste HTML codes in the "Text" view. For example, if he wants to paste his subscription HTML form, he could do that while switching to the "Text" mode. The issue …
I'm using wordpress API to display content. I'm using the classic editor since guttenberg is bugging out elsewhere. I noticed that if a paragraph does not have inline styles, wordpress does not save the <p> tags in the database. So when I call the api, the response is something like this: first paragraph. second paragraph. There isn't even a <br> tag in between, just a newline I believe. I just need to style paragraphs to be spaced apart, so I …
WordPress 5.2 destroys structured data by adding rel="noopener noreferrer" to widget output (also to shortcodes): How to display the shortcode output without code change? This feature was added in 5.2: https://core.trac.wordpress.org/ticket/43280 Basically there is nothing wrong with adding rel="noopener noreferrer" to <a href="..." target="_blank"></a> links, as it will protect from malicious comments or bad authors for instance. Anyway I have a shortcode from some plugin which is generating structured data (rating stars) for a website and embedded via shortcode. Adding …
When adding content into the description and short description fields for a product, line-breaks and tags are completely removed from the markup. Other than installing Advanced TinyMCE, is there any setting, filter, or hook I need to check to make these fields include elements. In review of the Product object array in WooCommerce, it looks like the value for description is wrapped in the wpautop() function, but it doesn't appear to be working (it's possibly I'm just not understanding this …
From my Googling, it appears as though the default behavior in Wordpress is to add paragraphs automatically, but in the HTML view, regardless of what style I choose in the Visual Editor's style drop-down (paragraph, for example), paragraph tags never appear. I also do not see wpautop() called anywhere in my theme (which I inherited from a now departed developer). What can I do to set this straight? Adding <p> tags to everything is obviously not going to fly with …
I run a website about a programming language which is very well-integrated with a front-end which adds a lot of styling to the code that cannot be replicated in the browser. For that reason, I publish my tutorials by having blocks of text interspersed with images of code. Clicking on the images copies the code to the clipboard so that people can use them in their own front-end. Here is what the HTML code for this looks like: <img src="..." …
I've registered a custom editor block with Advanced Custom Fields (ACF), and am using render_template with a PHP template partial to display the block contents. Inside the template is some HTML (section with a figure and an a inside it). When the block is called and the template generates the HTML, it's exactly as I author it, but when displayed on the front end, the a gets wrapped in a p tag, and a couple of br elements are added …
I use Tinymce Advanced plugin. I would like to remove p tag by adding this code remove_filter( 'the_content', 'wpautop' ); to my functions.php. However, it does't work. When I press ENTER, it still inserts double line, not single line. The p character still displays at the bottom left of the textarea.
Why does the text editor remove paragraphs and line breaks? Surely maintaining basic formatting such as paragraphs or line breaks is a basic requirement in all CMS systems. It's hard to believe that WordPress has remained the most popular content management system on the market when it's not even able to maintain basic text formatting. I've searched numerous forums - all of which recommend the TinyMCE Advanced plugin or manipulating the wpautop() function - but nowhere is there a clear …
So I have a quote in my page template and I would like to give the user the opportunity to add line breaks whenever they desire to do so. I wanted the blockquote to have an extra <p> tag inside the <blockquote> tag so I could style it better. The problem I'm having now is that the <br /> tags are being removed. While using the wpautop() function they should stay. Here is what I did: $matched = preg_match("~(?<=<blockquote>)([\s\S]+?)(?=</blockquote>)~", wpautop($child->post_content), …