Have placed <?php echo do_shortcode('[wcm_restrict plans="silver"]' .$the_content. '[/wcm_restrict]'); ?> into a template, but the content isn't appearing.

Have tested <?php echo do_shortcode('[wcm_restrict plans="silver"]Big Blue[/wcm_restrict]'); ?> so know the tags are working fine. Also tried get_the_content

Content appears also when just using <?php the_content(); ?>

What am I doing wrong?

1 Answer 1


It doesn't appear that the variable $the_content exists. I'm guessing what you want is the function the_content(), but since that actually echoes its output, that won't work either. You need to use the function get_the_content() which will return the output (as opposed to echoing it).

Try this:

echo do_shortcode('[wcm_restrict plans="silver"]' . get_the_content() . '[/wcm_restrict]');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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