Slowly
The builderBlocks

Code

Run your own PHP, JavaScript, HTML, or CSS from a block, with a live preview.

The Code block runs your own code, PHP, JavaScript, HTML, or CSS, directly from a block, and previews the result as you write. It is the escape hatch for anything a visual block does not cover.

Because it runs real code, access is controlled in the Role Editor. It is not open to every contributor by default.

Adding one

  1. Select the section or container to hold it.
  2. Open the inserter and search "code".
  3. Pick the Code block, then choose a language and write or paste your code.

Settings

In the code block's own panel. The shared design panel is documented at Styling.

SettingWhat it doesReach for it when
Language / RenderSelects whether the block runs PHP, HTML, CSS, or JavaScriptSet this first; the editor highlights and the output behaviour both follow it
ExecuteRuns the code and shows the output as a live preview in the editorOn by default; turn it off while writing a large block of PHP to avoid partial-execution errors mid-draft
Show blockControls whether the block is visible on the front endOff hides the output from visitors while keeping the block in place
Prevent clicksBlocks pointer events on the preview inside the editorUseful when the code renders interactive elements that get in the way of selecting the block
SkeletonShows a loading placeholder while the output is being computedOn by default; set the width, height, and radius to match the expected output

Styling

The Code block uses the shared design panel for spacing, colour, borders, and effects, each per breakpoint. Use states if the rendered output needs a hover or focus treatment applied at the wrapper level.

Accessibility

Code you write here is responsible for its own semantics. If the output includes interactive elements, buttons, links, form controls, write the appropriate ARIA labels and roles into the markup directly. The block does not add any for you.

On this page