Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

All docs

Writing code in the editor

The editor knows WordPress. It suggests functions and hooks as you type, explains them, writes boilerplate for you, and flags mistakes before you save.

Autocomplete

Start typing and the editor suggests:

  • 6,800+ functions from WordPress, WooCommerce and PHP, with their parameters and a short description.
  • 2,500+ WordPress hooks inside add_action() and add_filter().

Press Ctrl+Space to open the suggestions at any time. Press Enter or Tab to accept one.

The hook picker writes the callback

This is the fastest way to write a hook. Type:

add_action( '

Pick a hook from the list, for example save_post. Snipfire writes the whole thing with the hook's parameters already named, and puts the cursor inside the function:

add_action( 'save_post', function( $post_id, $post, $update ) {

}, 10, 3 );

For filters, it adds the return too:

add_filter( 'the_title', function( $post_title, $post_id ) {

    return $post_title;
}, 10, 2 );

When a hook passes more than one parameter, the priority (10) and the number of parameters are added at the end, so WordPress passes them all. For a hook with one parameter, they're left out.

Not sure which hook? With Snipfire Pro, the visual hook finder shows every hook on a real page of your site.

Hover documentation

Hover over a function or hook name to see its description, parameters, return value, the WordPress version it appeared in, and a Documentation link to the official reference. Deprecated functions are marked Deprecated.

Descriptions come from WordPress's own documentation and are in English.

Parameter hints

When you type the opening bracket of a function, a hint shows its parameters and highlights the one you're on.

Emmet (HTML and CSS)

Type an Emmet abbreviation and press Tab:

ul.menu>li*3>a

becomes

<ul class="menu">
    <li><a href=""></a></li>
    <li><a href=""></a></li>
    <li><a href=""></a></li>
</ul>

It works in HTML snippets and in CSS (for example m10 → margin: 10px;).

Formatting

Format (Shift+Alt+F) tidies the code with Prettier: indentation, spacing, line breaks. It works for PHP, CSS and JavaScript. Formatting only changes the layout, never what the code does.

Live error checking

The editor checks your code as you type:

  • PHP syntax errors
  • Functions or classes that already exist on the site (they'd crash it with "Cannot redeclare")
  • SCSS and LESS compile errors, even inside a partial (Pro)
  • Conditions that can't work at the chosen location

Problems are underlined on their line and listed in the Problems panel under the editor. No problems found. means you're clear. The same checks run again when you save: see How Snipfire keeps your site safe.

PHP tips

  • A PHP snippet can start with <?php or not, but leave off a closing ?> at the end: whitespace after it can break pages with "headers already sent". Snipfire warns you if you have one.
  • Error line numbers match the editor's line numbers.
  • Wrap functions you declare in if ( ! function_exists( 'my_function' ) ) if you plan to reuse the snippet on sites where it might already exist. Or use closures (function () { … }) in hooks, which can't clash.

Something unclear or missing? Tell us