Title: [Plugin: Custom Field Template] PHP code not working inside the_content hook
Last modified: August 19, 2016

---

# [Plugin: Custom Field Template] PHP code not working inside the_content hook

 *  [Wasee](https://wordpress.org/support/users/wasee/)
 * (@wasee)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-php-code-not-working-inside-the_content-hook/)
 * I tried both shortcodes and direct php to display custom fields inside the_content
   hook but no success
 * For example my custom field was **Display** tried both methods but didn’t work
   even tried to execute a simple php echo but that’s also not working but i can
   confirm html and plain text is working fine inside the hook.
 * [Display]
 * <?php
    if ( get_post_meta($post->ID, ‘Display’, true) ) { echo get_post_meta(
   $post->ID, “Display”, true); } ?>
 * So any suggestion?

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

 *  [html-css](https://wordpress.org/support/users/html-css/)
 * (@html-css)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-php-code-not-working-inside-the_content-hook/#post-1933333)
 * Facing same issue as Wasee mentioned so any available fix for this?
 *  [html-css](https://wordpress.org/support/users/html-css/)
 * (@html-css)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-php-code-not-working-inside-the_content-hook/#post-1933410)
 * Hiroaki Miyashita any reply for this issue please?
 *  Plugin Author [Hiroaki Miyashita](https://wordpress.org/support/users/hiroaki-miyashita/)
 * (@hiroaki-miyashita)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-php-code-not-working-inside-the_content-hook/#post-1933426)
 * Please add the following line before using $post.
 *     ```
       global $post;
       ```
   
 * You can also use the cft shortcode.
 *     ```
       [cft key='Display']
       ```
   
 *  [waylaydesign](https://wordpress.org/support/users/waylaydesign/)
 * (@waylaydesign)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-php-code-not-working-inside-the_content-hook/#post-1933508)
 * I think this thread has the answer you are looking for:
 * [http://wordpress.org/support/topic/plugin-custom-field-template-insert-custom-code-into-a-template](http://wordpress.org/support/topic/plugin-custom-field-template-insert-custom-code-into-a-template)
 *  [html-css](https://wordpress.org/support/users/html-css/)
 * (@html-css)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-php-code-not-working-inside-the_content-hook/#post-1933510)
 * Thanks **Hiroaki Miyashita** it works perfectly!

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

The topic ‘[Plugin: Custom Field Template] PHP code not working inside the_content
hook’ is closed to new replies.

 * ![](https://ps.w.org/custom-field-template/assets/icon-256x256.png?rev=1966286)
 * [Custom Field Template](https://wordpress.org/plugins/custom-field-template/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-field-template/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-field-template/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-field-template/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-field-template/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-field-template/reviews/)

 * 5 replies
 * 4 participants
 * Last reply from: [html-css](https://wordpress.org/support/users/html-css/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-php-code-not-working-inside-the_content-hook/#post-1933510)
 * Status: not resolved