I’ve got a pb with the visual composer shortcode add on the article.
I’ve made a personal shortcode in my function.php theme which list the last 3 articles.
Here the code :

//* Actus (Homepage)
function actus_home(){

        $args = array(
            'post_type' => 'post',
            'posts_per_page' => '3',
            'orderby' => 'date',
            'order' => 'DESC',
        );

        $string = '';
        $query = new WP_Query( $args );
        if( $query->have_posts() ){
            while( $query->have_posts() ){
                $query->the_post();
                $string .= '<div class="actus_home">';
                $string .= '<h4><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></h4>';;
                $string .= '<a href="' . get_the_permalink() . '">';
                $string .= get_the_post_thumbnail();
                $string .= '</a>';
                $string .= '<p>';
                $string .= wp_trim_words(get_the_content() , '30' );
                $string .= '</p>';
                $string .= '<a class="btn_actu" href="' . get_the_permalink() . '">Lire la suite</a>';
                $string .= '</div>';
            }
        }
        wp_reset_postdata();
        return $string;
    }

add_shortcode( 'actus_home', 'actus_home' );

That’s OK. In an article, i’ve used visual composer.
So, my shortcode print some code like this for get_the_content().

[vc_row][vc_column width="2/3"][vc_column_text]• Pr√©chauffez le four √†

How can i delete these codes: [vc_row][vc_column width=”2/3″][vc_column_text]?

Thanks for your help.

Gwendall

Read more here: Delete VC shortcode on a personal shortcode


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: