5
votes
Accepted
WooCommerce Description and Short Description <p> tags removal
So, I realized I was using the actual object in the template to call the description $product-get_description(). If you're experiencing this issue, then you can wrap this in a wpautop(), or you can do ...
4
votes
remove empty paragraphs from the_content?
Same approach than 2 answers before me,
but an updated regex, because his didn't work for me.
the regex: /<p>(?:\s| )*?<\/p>/i
(non capture group looking for any number of either ...
4
votes
How do I disable wpautop for a specific block?
@morgan-estes Great solution but it i think it should be better to add_filter in else so the next block or content gets filter with WPAUTOP
/**
* Try to disable wpautop inside specific blocks.
*
* ...
3
votes
How do I disable wpautop for a specific block?
I've found that I can use the render_block filter to disable wpautop() when a block gets rendered. It looks to me that this only affects the immediate block, as the filter gets re-enabled from ...
3
votes
Is there un-wp_autop function?
I also needed a way to do this but wasn't happy with any existing solutions so decided to make one. Hope it helps someone.
<?php
/**
* Replaces paragraph elements with double line-breaks.
*
* ...
2
votes
Remove wpautop from shortcode content / remove whitespace in buffering
There is a WordPress function available that does this job nicely. There isn't any need to use a custom function or a plugin to do this.
Just use the shortcode_unautop($pee) function to remove ...
2
votes
Shortcode from a widget is wrapped in unwanted <p> element
This is a known issue since years. Please have a look at Wordpress Ticket.
As others maybe mentioned before, there is Plugin to fix this issue. It is called "Shortcode Empty Paragraph Fix". Its not ...
2
votes
Why does WP not like my <a> container?
I think it's safe to say that wpautop() is a basket case without hurting anyone's feelings, but I wouldn't remove & add it at a different priority as that just makes things worse, as demonstrated (...
2
votes
Remove wpautop from specific shortcodes only
Well, there is a script out there. The author claims that it removes the wpautop form individual specific shorcodes. You'll find it here.
Add this to your functions.php or your plugin like below-
// ...
2
votes
How to disable auto-p in WordPress?
In your child theme's functions.php, try something like this:
remove_filter( 'the_content', 'wp_autop' );
Note that this may have unintended side-effects, and will definitely have an effect on how ...
1
vote
How to call a PHP function in WordPress when you click on a button?
Take a look at AJAX in Plugins which uses admin-ajax.php. This is a way for you to interact with WordPress via a javascript request to WordPress.
1
vote
Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?
Try this code:
add_filter( 'wp_targeted_link_rel', '__return_false', 9999 );
function widget_text_replace($text) {
$search = array('rel="noopener"');
$replace = array('');
$text = ...
1
vote
Remove empty p-Tags in Shortcode content before non p-Tags
The empty p tag in the developer console means that you have other HTML being outputted inside it, which shouldn't be there. i.e the H5 tag for the heading.
This is because "do_shortcode" uses the ...
1
vote
Images that copy code to clipboard when you click on them
I think that clipboard.js is your best bet to what you're looking for.
Install that script, then just change your img to
<img src="..." data-clipboard-text="...">
And you should be good to ...
1
vote
remove_filter( 'the_content', 'wpautop' ); is not working for me
You can achieve this much easier with css (escpecially for wp-ers who dont have access to edit plugins):
<style>
p:empty{
height: 0;
margin: 0;
padding: 0;
}
</style>
1
vote
Extra paragraph tags in an enclosing shortcode
OK, it seems someone has trod this path and there is in fact....
shortcode_unautop()
Job Done. It looks elegant in the editor and works in the output.
The shortcode now looks like this;
function ...
1
vote
Accepted
Selectively remove empty line after line change
gdaniel answered the bulk of question with this comment:
Every time you type Enter (the return character) the editor
creates a new paragraph <p>my content</p>, the alternative is to
...
1
vote
New method to disable wpautop after WP 4.3?
This works well. It's about the priority of the hook :
add_filter( 'the_content', 'njengah_remove_autop', 0 );
function njengah_remove_autop($content) {
// remove autop
...
1
vote
Raw output (preventing wpautop)
Late to the party, but this plugin, Toggle wpautop, lets you selectively disable whether you want WP to butcher your content on pages or posts, and works on WP 4.9 (current version as of this answer).
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
wp-autop × 82shortcode × 24
tinymce × 14
filters × 10
formatting × 7
functions × 6
line-breaks × 6
php × 4
theme-development × 4
the-content × 4
editor × 4
customization × 3
html × 3
wp-editor × 3
custom-post-types × 2
custom-field × 2
wp-admin × 2
widgets × 2
block-editor × 2
visual-editor × 2
post-editor × 2
wysiwyg × 2
html-editor × 2
plugins × 1
plugin-development × 1