1

I built a plugin, and I would like to use shortcodes in the integrated wp_editor.

I'm using echo to display the content of the wp_editor, so I think that's the problem why I can't use the shortcode. What's the method to do that?

I'm using the following code for shortcode:

add_shortcode('facebook', 'facebook');

function facebook($atts) {
    $options = get_option( 'social_options' );
    return '<a class="socialmedia socialfacebook" href="'.$options["facebook"].'">Facebook</a>';
}

..and the following code to get the content of the wp_editor:

<?php
    $footer = get_option('footer_options');
    $footer_content = array($footer['footer_content_1'], $footer['footer_content_2']);
    foreach($footer_content as $content) {
        echo'<aside class="tab-content">
            '.$content.'
        </aside>';
    }
?>
4

try doing this

 <?php
$footer = get_option('footer_options');
$footer_content = array($footer['footer_content_1'], $footer['footer_content_2']);
foreach($footer_content as $content) {
 $content = apply_filters('the_content', $content);
    echo'<aside class="tab-content">
        '.$content.'
    </aside>';
}
 ?>

I once had the same issue and applying the content filter solved it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.