Shortcode löschen

  • Ich bekomme es nicht hin. Ich will ein vorhanden Shortcode löschen und eins mit dem gleichen Namen erstellen.


    Child Theme Funktions.php

    Code
    function shortcode_cleaner() {
        remove_shortcode( 'information' );
        add_shortcode( 'information', 'my_remove_shortcode' );
    }
    add_action( 'init', 'shortcode_cleaner' );
    
    
    function my_remove_shortcode( $atts, $content = null ) {  
            
            return '<div class="information"><p><span>Test  </span>' .do_shortcode($content). '</p></div>';   }


    original shortcodes.php

    keine ahnung ob ich noch was vergessen habe, aber er zeigt immer wieder das alte an.

    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

  • Update:

    Wenn ich den Shortcode im Text umnennen in [informations]1233[/informations] udn dann die untere funktioneinfüge dann stript er das auch raus nur die original würde auch nicht gehen mit stripe. und demnach auch nicht mit remove

    function shortcode_cleaner() {
    remove_shortcode( 'information' );
    add_shortcode( 'informations', 'my_remove_shortcode' );
    }
    add_action( 'init', 'shortcode_cleaner' );

    function my_remove_shortcode( $atts, $content = null ) {

    return '<div class="information"><p><span>Test </span>' .do_shortcode($content). '</p></div>';

    }


    function remove_shortcode_from_index($content) {
    $content = strip_shortcodes($content);
    return $content;
    }
    add_filter('the_content', 'remove_shortcode_from_index');


Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!