entferne leere <p> tags von wordpress shortcodes über eine php funktion

Auf der Suche nach einem Ansatz zum Entfernen einer PHP-Funktion (keine jQuery- oder wpautop-Modifikation)<p></p> aus WordPress.

Ich habe es versucht, aber es funktioniert nicht:

        function cleanup_shortcode_fix($content) {   
          $array = array (
            '<p>[' => '[', 
            ']</p>' => ']', 
            ']<br />' => ']',
            ']<br>' => ']'
          );
          $content = strtr($content, $array);
            return $content;
        }
        add_filter('the_content', 'cleanup_shortcode_fix');

Antworten auf die Frage(7)

Ihre Antwort auf die Frage