• Resolved jlanpheer

    (@jlanpheer)


    I’ve read some documentation that using the Gutenberg “Code <>” block you can insert PHP code into a block thusly:

    [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

    (@jordesign)

    Hi @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://ww.wp.xz.cn/plugins/code-snippets/

    Thread Starter jlanpheer

    (@jlanpheer)

    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.