Title: php code wrapped with html comments
Last modified: March 2, 2022

---

# php code wrapped with html comments

 *  Resolved [billysgtr](https://wordpress.org/support/users/billysgtr/)
 * (@billysgtr)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/php-code-wrapped-with-html-comments/)
 * Hi, I am using Code Editor type in PHP mode.
    I add php code in the field but
   it is wrapped with html comments <!– ->
 * Is this normal for security reasons? Or is it possible to add php code in the
   field?
 * Thanks
 * WP Version 5.9.1
    ACF Pro Version 5.12 Advanced Custom Fields: Extended Version
   0.8.8.7

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

 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-code-wrapped-with-html-comments/#post-15499033)
 * Hello,
 * Thanks for the feedback!
 * Yes, it is normal if you entered a value such as:
 *     ```
       <?php echo 'Hello World'; ?>
       ```
   
 * WordPress will automatically add comments when using `get_field()` or the native`
   get_post_meta()` function, for security reasons. I wouldn’t recommend to use 
   that Field to render PHP code. But if you really want to do it you could enter
   the following value:
 *     ```
       echo 'Hello World';
       ```
   
 * And then `eval()` ([see documentation](https://www.php.net/manual/en/function.eval.php))
   the code on the front-end using the following code:
 *     ```
       <?php eval(get_field('my_code')); ?>
       ```
   
 * Please note that using this method is _very_ dangerous, I wouldn’t recommend 
   using it unless you really know what you’re doing.
 * Hope it helps!
 * Have a nice day!
 * Regards.
 *  Thread Starter [billysgtr](https://wordpress.org/support/users/billysgtr/)
 * (@billysgtr)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-code-wrapped-with-html-comments/#post-15499395)
 * Hi,
    Yes, I understand.
 * THanks for the reply.
 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/php-code-wrapped-with-html-comments/#post-15499486)
 * You’re welcome!
 * Have a nice day!
 * Regards.

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

The topic ‘php code wrapped with html comments’ is closed to new replies.

 * ![](https://ps.w.org/acf-extended/assets/icon-256x256.png?rev=2071550)
 * [Advanced Custom Fields: Extended](https://wordpress.org/plugins/acf-extended/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-extended/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-extended/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-extended/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-extended/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-extended/reviews/)

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/php-code-wrapped-with-html-comments/#post-15499486)
 * Status: resolved