Title: PHP doesn&#039;t work the same as shortcodes
Last modified: August 20, 2016

---

# PHP doesn't work the same as shortcodes

 *  Resolved [Clifford Paulick](https://wordpress.org/support/users/cliffpaulick/)
 * (@cliffpaulick)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/php-doesnt-work-the-same-as-shortcodes/)
 * I used the PHP code you provided here: [http://wpstorm.net/wordpress-plugins/post-snippets/](http://wpstorm.net/wordpress-plugins/post-snippets/)
 * Example:
 *     ```
       <?php
           $my_snippet = get_post_snippet( 'internal-link', 'title=Awesome&url=2011/02/awesome/' );
           echo $my_snippet;
       ?>
       ```
   
 * It echos the exact Snippet box’s content, not the “parsed” (or rendered or whatever)
   output. But the shortcodes do work as intended.
 * Why? 🙁
 * P.S. If I can get this working, it’ll be EXACTLY what I’ve been searching VERY
   LONG for, ever since Hana Code stopped working (and looks like no longer supported).
 * Thanks!!!

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/php-doesnt-work-the-same-as-shortcodes/#post-2200543)
 * i assume that if executed as shortcode, it automatically runs throught the ‘the_content’
   filter together with the other post content;
 * try:
 * `echo apply_filters('the_content', $my_snippet);`
 *  Thread Starter [Clifford Paulick](https://wordpress.org/support/users/cliffpaulick/)
 * (@cliffpaulick)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/php-doesnt-work-the-same-as-shortcodes/#post-2200555)
 * I did this: [http://codex.wordpress.org/Function_Reference/do_shortcode](http://codex.wordpress.org/Function_Reference/do_shortcode)
 * `<?php echo do_shortcode('[Video Display Tips]'); ?>`
 * I didn’t try your version, but if you have multiple snippets in the template,
   would it know which “my_snippet” to use?
 *  Thread Starter [Clifford Paulick](https://wordpress.org/support/users/cliffpaulick/)
 * (@cliffpaulick)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/php-doesnt-work-the-same-as-shortcodes/#post-2200579)
 * However, my version (do_shortcode) isn’t perfect because
 * > [Video Display Tips]
 * is displayed if that shortcode is empty.

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

The topic ‘PHP doesn't work the same as shortcodes’ is closed to new replies.

 * ![](https://ps.w.org/post-snippets/assets/icon-128x128.gif?rev=2545587)
 * [Post Snippets - Custom WordPress Code Snippets Customizer](https://wordpress.org/plugins/post-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/post-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-snippets/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Clifford Paulick](https://wordpress.org/support/users/cliffpaulick/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/php-doesnt-work-the-same-as-shortcodes/#post-2200579)
 * Status: resolved