Title: shortcodes do not work correctly using do_shortcode() function
Last modified: August 24, 2016

---

# shortcodes do not work correctly using do_shortcode() function

 *  Resolved [jaykdoe](https://wordpress.org/support/users/jaykdoe/)
 * (@jaykdoe)
 * [11 years ago](https://wordpress.org/support/topic/shortcodes-do-not-work-correctly-using-do_shortcode-function/)
 * I am working on a custom layout using the do_shortcode() function within a page
   template.
 * The only instance that works is this:
    `echo do_shortcode( '[pmpro_account]' );`
 * Any other shortcode from the list simply outputs the text of the shortcode.
 * For instance, using
    `echo do_shortcode( '[pmpro_account]' );`
 * Simply displays “[pmpro_billing]” rather than displaying the billing page content.
 * Any ideas on why this is happening or how to fix it?
 * [https://wordpress.org/plugins/paid-memberships-pro/](https://wordpress.org/plugins/paid-memberships-pro/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Austin Adamson](https://wordpress.org/support/users/austin-adamson/)
 * (@austin-adamson)
 * [11 years ago](https://wordpress.org/support/topic/shortcodes-do-not-work-correctly-using-do_shortcode-function/#post-6159137)
 * Hey jaykdoe,
 * As I am waiting for someone to respond to my support thread, I figured I will
   try to help you out. I am not sure why the do_shortcode function isn’t working
   as intended but I can offer an alternative. You can use the “the_content” filter.
   The filter executed shortcodes before they are displayed in page content. The
   alternative would look like this:
 * `echo apply_filters('the_content', "[pmpro_account]");`
 * In my opinion, whether or not this is proper is up for debate and depends on 
   how exactly you are using it. Either way, this should work fine.
 * I’ll check this thread to see if it worked.
 *  Thread Starter [jaykdoe](https://wordpress.org/support/users/jaykdoe/)
 * (@jaykdoe)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/shortcodes-do-not-work-correctly-using-do_shortcode-function/#post-6159413)
 * Austin,
 * Thank you very much for your suggestion. Unfortunately I’m still running in to
   the same issue where the [pmpro_account] shortcode seems to work but none of 
   the others do. I appreciate your input, but hopefully pmpro support will look
   into this and help identify the issue when they have time.
 * Thanks again!
 *  [essaysnark](https://wordpress.org/support/users/essaysnark/)
 * (@essaysnark)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/shortcodes-do-not-work-correctly-using-do_shortcode-function/#post-6159420)
 * I believe what you’re describing is known behavior; the PMPro shortcodes won’t
   work with the do_shortcode call. Try this as a possible solution:
 *     ```
       //make sure this is called before the header loads (may want to put it in a wp or init hook and make sure it only runs on the right page
       include(PMPRO_DIR . "/preheaders/levels.php");
   
       //put this where you want the page content to show up
       include(PMPRO_DIR . "/pages/levels.php");
   
       //or this inside your template:
       <?php include( get_stylesheet_directory() . "/paid-memberships-pro/pages/account.php"); ?>
       ```
   
 * Separately, there are some updates re: shortcodes in today’s 1.8.4.2 release.
 * [http://www.paidmembershipspro.com/2015/05/pmpro-update-1-8-4-2/](http://www.paidmembershipspro.com/2015/05/pmpro-update-1-8-4-2/)
 *  Thread Starter [jaykdoe](https://wordpress.org/support/users/jaykdoe/)
 * (@jaykdoe)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/shortcodes-do-not-work-correctly-using-do_shortcode-function/#post-6159426)
 * WOW, essaysnark thank you!! This works exactly as I had hoped the do_shortcode
   call would.
 * Thank you very much for chiming in on this and providing your knowledge of the
   known issue, as I’m not sure I would’ve solved this on my own.
 * It doesn’t look like the recent updates resolved the shortcode issue I was facing,
   but your code did.
 * Thanks again to both you and Adam for helping me resolve this.
 *  [essaysnark](https://wordpress.org/support/users/essaysnark/)
 * (@essaysnark)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/shortcodes-do-not-work-correctly-using-do_shortcode-function/#post-6159428)
 * Can’t claim much credit – your problem sounded familiar to something we’d encountered,
   but the actual solution came from a quick search on the PMPro Members Support
   Forum. If you’re doing anything beyond a vanilla install, paying for the support
   is well worth it, IMO, if only because it gives you access to that. (No, not 
   affiliated with them, just happy users.)
 * Anyway glad you got past this one! Good luck with your site.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘shortcodes do not work correctly using do_shortcode() function’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/paid-memberships-pro_f1dacb.svg)
 * [Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions](https://wordpress.org/plugins/paid-memberships-pro/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/paid-memberships-pro/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/paid-memberships-pro/)
 * [Active Topics](https://wordpress.org/support/plugin/paid-memberships-pro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/paid-memberships-pro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/paid-memberships-pro/reviews/)

## Tags

 * [do_shortcode](https://wordpress.org/support/topic-tag/do_shortcode/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 5 replies
 * 3 participants
 * Last reply from: [essaysnark](https://wordpress.org/support/users/essaysnark/)
 * Last activity: [10 years, 12 months ago](https://wordpress.org/support/topic/shortcodes-do-not-work-correctly-using-do_shortcode-function/#post-6159428)
 * Status: resolved