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.
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.
Add a priority to push your function to the end of the hook queue. add_action(‘the_content’, ‘my_plugin_content_hook’, 1000); Then, in your get_special_content function you will need to apply wpautop manually to the content to which you want it applied. function get_special_content() { $text=””; $autopeed = ‘content to autop’; $text .= apply_filters(‘wpautop’,$autopeed); $text .= “your textarea code”; … Read more
If what you want is really only to prevent WordPress from adding empty <p></p> and you’d be happy with removing those after post retrieval from the database, then function wpse108194_remove_empty_paragraphs( $content ) { $content = preg_replace( ‘#<p>\s*</p>#’, ”, $content ); return $content; } add_filter( ‘the_content’, ‘wpse108194_remove_empty_paragraphs’, 11 ); will do.
Don’t use the_excerpt() if you want to have line-breaks 😉
This is actually an example of the wpautop() function‘s intended purpose. From the Codex: Changes double line-breaks in the text into HTML paragraphs (<p>…</p>). Note that the example provided in the Codex explicitly uses a string that begins with a line-break for this very purpose: <?php $some_long_text = // Start Text Some long text that … Read more
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- // Here I assumed that you kept the name of the PHP script file same include “shortcode-wpautop-control.php”; And then call the function … Read more
@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. * * @link https://wordpress.stackexchange.com/q/321662/26317 * * @param string $block_content The HTML generated for the block. * @param array $block The block. … Read more
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 wpautop filter which wraps everything in a p tag Try remove the wpautop filter, run do_shortcode, and then re add … Read more
WordPress editor strips out anchor tags when they appear on their own line
WordPress blockquote removes “ tag