Title: Shortcode Empty Paragraph Fix
Author: Johann Heyne
Published: <strong>10 de juliol de 2011</strong>
Last modified: 22 de gener de 2016

---

Cerca extensions

Aquesta extensió **no s’ha provat en les darreres 3 versions majors del WordPress**.
Segurament no està mantinguda o suportada, i pot tenir problemes de compatibilitat
quan s’usa en versions recents del WordPress.

![](https://s.w.org/plugins/geopattern-icon/shortcode-empty-paragraph-fix.svg)

# Shortcode Empty Paragraph Fix

 Per [Johann Heyne](https://profiles.wordpress.org/jonua/)

[Baixa](https://downloads.wordpress.org/plugin/shortcode-empty-paragraph-fix.zip)

 * [Detalls](https://ca.wordpress.org/plugins/shortcode-empty-paragraph-fix/#description)
 * [Ressenyes](https://ca.wordpress.org/plugins/shortcode-empty-paragraph-fix/#reviews)
 *  [Instal·lació](https://ca.wordpress.org/plugins/shortcode-empty-paragraph-fix/#installation)
 * [Desenvolupament](https://ca.wordpress.org/plugins/shortcode-empty-paragraph-fix/#developers)

 [Suport](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/)

## Descripció

Fix [known issues](https://core.trac.wordpress.org/ticket/12061) when shortcodes
are embedded in a block of content that is filtered by wpautop.

#### for Theme Developers

If you are developing a theme to provide this on a marketplace, you better embed
the following code in your functions.php. This code filters only the shortcodes 
you defined. Otherwise you risk a failed review because the code in the plugin filters
content in general which may is not acceptet.

    ```
    function shortcode_empty_paragraph_fix( $content ) {

        // define your shortcodes to filter, '' filters all shortcodes
        $shortcodes = array( 'your_shortcode_1', 'your_shortcode_2' );

        foreach ( $shortcodes as $shortcode ) {

            $array = array (
                '<p>[' . $shortcode => '[' .$shortcode,
                '<p>[/' . $shortcode => '[/' .$shortcode,
                $shortcode . ']</p>' => $shortcode . ']',
                $shortcode . ']<br />' => $shortcode . ']'
            );

            $content = strtr( $content, $array );
        }

        return $content;
    }

    add_filter( 'the_content', 'shortcode_empty_paragraph_fix' );
    ```

Another solution that is acceptet at the envato (themeforest) marketplace comes 
from [bitfade](https://gist.github.com/bitfade/4555047).

## Instal·lació

 1. Upload folder `shortcode-empty-paragraph-fix` to the `/wp-content/plugins/` directory
 2. Activa l’extensió mitjançant el menú ‘Extensions’ del WordPress

o

If you dont want to use a whole plugin to solve that bug, you can copy the code 
of the plugin file shortcode-empty-paragraph-fix.php into your theme function.php

## PMF

  Installation Instructions

 1. Upload folder `shortcode-empty-paragraph-fix` to the `/wp-content/plugins/` directory
 2. Activa l’extensió mitjançant el menú ‘Extensions’ del WordPress

o

If you dont want to use a whole plugin to solve that bug, you can copy the code 
of the plugin file shortcode-empty-paragraph-fix.php into your theme function.php

## Ressenyes

![](https://secure.gravatar.com/avatar/0fdcb3c1f606e84db3d801ef61e200a3a38bc6da0d78fbb8393f9a1957610280?
s=60&d=retro&r=g)

### 󠀁[Just what I needed.](https://wordpress.org/support/topic/just-what-i-needed-646/)󠁿

 [](https://profiles.wordpress.org/truetone/) 5 de octubre de 2017

Thanks for this fix. Worked great for me!

![](https://secure.gravatar.com/avatar/d952305e451542b406e068990c629ea7eafcbde0641f4c2a438501f1ba5b79bc?
s=60&d=retro&r=g)

### 󠀁[Thanks! It solves my issue](https://wordpress.org/support/topic/thanks-it-solves-my-issue/)󠁿

 [Elisabeth Pointal](https://profiles.wordpress.org/epointal/) 14 de juliol de 2017

This simply plugin resolve the issue in mine. I added the function and filter to
my own plugin if it did not already exist.

![](https://secure.gravatar.com/avatar/8df1cc227b62b6dfb9bf9a3785b19ed671d50c4ff028f36e70df22302787777b?
s=60&d=retro&r=g)

### 󠀁[It’s work](https://wordpress.org/support/topic/its-work-11/)󠁿

 [studio-jt](https://profiles.wordpress.org/studiojt/) 2 de febrer de 2017

The standalone function work great , thank you

 [ Llegiu totes les 21 ressenyes ](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/reviews/)

## Col·laboradors i desenvolupadors

«Shortcode Empty Paragraph Fix» és programari de codi obert. La següent gent ha 
col·laborat en aquesta extensió.

Col·laboradors

 *   [ Johann Heyne ](https://profiles.wordpress.org/jonua/)

[Traduïu «Shortcode Empty Paragraph Fix» a la vostra llengua.](https://translate.wordpress.org/projects/wp-plugins/shortcode-empty-paragraph-fix)

### Interessats en el desenvolupament?

[Navegueu pel codi](https://plugins.trac.wordpress.org/browser/shortcode-empty-paragraph-fix/),
baixeu-vos el [repositori SVN](https://plugins.svn.wordpress.org/shortcode-empty-paragraph-fix/),
o subscriviu-vos al [registre de desenvolupament](https://plugins.trac.wordpress.org/log/shortcode-empty-paragraph-fix/)
per [fisl de subscripció RSS](https://plugins.trac.wordpress.org/log/shortcode-empty-paragraph-fix/?limit=100&mode=stop_on_copy&format=rss).

## Registre de canvis

#### 0.1

 * Versió inicial

#### 0.2

 * nicer code writing style

## Meta

 *  Versió **0.2**
 *  Darrera actualització **fa 11 anys**
 *  Instal·lacions actives **800+**
 *  Versió del WordPress ** 2.5 o posterior **
 *  Provada fins a **4.8.29**
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/shortcode-empty-paragraph-fix/)
 * Etiquetes
 * [fix](https://ca.wordpress.org/plugins/tags/fix/)[shortcode](https://ca.wordpress.org/plugins/tags/shortcode/)
 *  [Vista avançada](https://ca.wordpress.org/plugins/shortcode-empty-paragraph-fix/advanced/)

## Valoracions

 4.8 sobre 5 estrelles.

 *  [  19 valoracions de 5 estrelles     ](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/reviews/?filter=5)
 *  [  0 valoracions de 4 estrelles     ](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/reviews/?filter=4)
 *  [  0 valoracions de 3 estrelles     ](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/reviews/?filter=3)
 *  [  0 valoracions de 2 estrelles     ](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/reviews/?filter=2)
 *  [  1 valoració de 1 estrelles     ](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/reviews/#new-post)

[Visualitzeu totes les ressenyes](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/reviews/)

## Col·laboradors

 *   [ Johann Heyne ](https://profiles.wordpress.org/jonua/)

## Suport

Teniu quelcom a dir? Necessiteu ajuda?

 [Visualitza els fòrums de suport](https://wordpress.org/support/plugin/shortcode-empty-paragraph-fix/)