Title: PHP code block
Last modified: May 2, 2024

---

# PHP code block

 *  Resolved [jlanpheer](https://wordpress.org/support/users/jlanpheer/)
 * (@jlanpheer)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-code-block/)
 * I’ve read some documentation that using the Gutenberg “Code <>” block you can
   insert PHP code into a block thusly:
 *     ```wp-block-code
       [php]
       <?php
       echo 'Hello World';
       ?>
       [/php]
       ```
   
 * However, the output of the block is the the raw code. Is this possible? Something
   i am missing?

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

 *  Moderator [jordesign](https://wordpress.org/support/users/jordesign/)
 * (@jordesign)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-code-block/#post-17733734)
 * Hi [@jlanpheer](https://wordpress.org/support/users/jlanpheer/) – what you’re
   seeing is correct. The Code block is used to _display _code, but not actually
   action it. If you’re hoping to include PHP functions to actually run – I’d recommend
   using a Code Snippet plugin like this one:
 * [https://wordpress.org/plugins/code-snippets/](https://wordpress.org/plugins/code-snippets/)
 *  Thread Starter [jlanpheer](https://wordpress.org/support/users/jlanpheer/)
 * (@jlanpheer)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-code-block/#post-17747836)
 * Ah gotcha, thanks for the explanation, and yes, i had already done that. Thanks
   for the suggestion.

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

The topic ‘PHP code block’ is closed to new replies.

 * ![](https://ps.w.org/gutenberg/assets/icon-256x256.jpg?rev=1776042)
 * [Gutenberg](https://wordpress.org/plugins/gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gutenberg/reviews/)

## Tags

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

 * 2 replies
 * 2 participants
 * Last reply from: [jlanpheer](https://wordpress.org/support/users/jlanpheer/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/php-code-block/#post-17747836)
 * Status: resolved