Skip to main content
Documentation/Developers/Tools/Use PHP in Breakdance

Use PHP in Breakdance

Use Code Block > Content → Content → PHP & HTML Code for server-rendered content:

PHP
<p class="acme-copyright">
    &copy; <?php echo esc_html(wp_date('Y')); ?>
    <?php echo esc_html(get_bloginfo('name')); ?>
</p>

Save to render. HTML outside PHP tags outputs directly; PHP must echo/output, not merely return a string.

Full Breakdance editor with a Code Block selected, PHP & HTML Code showing the copyright snippet, and rendered output visible
Full Breakdance editor with a Code Block selected, PHP & HTML Code showing the copyright snippet, and rendered output visible

Execute JavaScript controls the JavaScript field, not PHP. See Code Block controls.

Rendering Behavior

Code runs during visitor requests, previews, and loops. Avoid repeated function registration, migrations, notifications, or record creation. PHP is not sandboxed; authorize private data and escape text/attributes/URLs with esc_html(), esc_attr(), and esc_url().

Put hooks/classes in a plugin, defer Breakdance classes until loaded, and avoid relying on disabled theme functions.

The renderer catches ParseError, not every runtime exception/fatal error. Revert faulty snippets and use error logs.