Developer Tools
Full Developer Control Without Hacking Core
BF Blocks is built to be extended. Hooks, filters, a REST API, WP-CLI integration, and PHP template overrides give developers complete control — without modifying the plugin.
Read Developer DocsExtensibility
Hooks & Filters
All BF Blocks hooks are prefixed bf_blocks/ for easy discoverability. Hook into block saving, rendering, field registration, and more.
bf_blocks/before_renderFires before a block renders on the front end.
bf_blocks/after_renderFires after a block renders.
bf_blocks/register_field_typeRegister a custom field type class.
bf_blocks/block_savedFires when a block definition is saved or updated.
bf_blocks/field_valueModify a field's value before it is passed to the template.
Registering a custom field type via filter
add_filter(
'bf_blocks/register_field_type',
function( array $types ): array {
$types['star_rating'] = Star_Rating_Field::class;
return $types;
}
);
class Star_Rating_Field extends BF_Field_Base {
public function get_type(): string {
return 'star_rating';
}
public function render_editor(): void {
// Outputs the Gutenberg editor control
}
public function get_value( mixed $raw ): int {
return absint( $raw );
}
}REST API
Manage Blocks Programmatically
The BF Blocks REST API supports WP Nonce and Application Password authentication. Base URL: /wp-json/bf-blocks/v1
| Method | Endpoint |
|---|---|
| GET | /wp-json/bf-blocks/v1/blocks |
| GET | /wp-json/bf-blocks/v1/blocks/{id} |
| POST | /wp-json/bf-blocks/v1/blocks |
| PUT | /wp-json/bf-blocks/v1/blocks/{id} |
| DELETE | /wp-json/bf-blocks/v1/blocks/{id} |
Templates
PHP Template Overrides
Override the default front-end output of any block by creating a PHP template in your theme. BF Blocks follows a template hierarchy — your override takes priority automatically.
Template path (in your theme)
themes/your-theme/bf-blocks/{block-slug}.phpThree variables are available inside every template: $fields (associative array of field values), $block (block metadata), and $is_preview (bool).
themes/my-theme/bf-blocks/testimonial.php
<?php
/**
* BF Blocks template override: testimonial
* Available vars: $fields, $block, $is_preview
*/
$quote = $fields['quote_text'] ?? '';
$author = $fields['author_name'] ?? '';
$role = $fields['author_role'] ?? '';
$photo = $fields['author_photo'] ?? [];
?>
<figure class="bf-testimonial <?php
echo esc_attr( $block['className'] ?? '' );
?>">
<blockquote>
<p><?php echo wp_kses_post( $quote ); ?></p>
</blockquote>
<figcaption>
<?php if ( ! empty( $photo['url'] ) ) : ?>
<img src="<?php echo esc_url( $photo['url'] ); ?>"
alt="<?php echo esc_attr( $author ); ?>"
width="48" height="48">
<?php endif; ?>
<strong><?php echo esc_html( $author ); ?></strong>
<span><?php echo esc_html( $role ); ?></span>
</figcaption>
</figure>WP-CLI
Command-Line Control
| Command |
|---|
wp bf-blocks list |
wp bf-blocks export --block=<slug> |
wp bf-blocks import <file> |
wp bf-blocks flush-cache |
wp bf-blocks version |
Jump Into the Developer Docs
Full reference for every hook, filter, endpoint, and CLI command.