Filter hook 'should_load_remote_block_patterns'

in WP Core File wp-includes/block-patterns.php at line 306

View Source

should_load_remote_block_patterns

Filter Hook
Description
Registers patterns from Pattern Directory provided by a theme's `theme.json` file. format expected by `register_block_pattern()` (camelCase).

Hook Information

File Location wp-includes/block-patterns.php View on GitHub
Hook Type Filter
Line Number 306

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into should_load_remote_block_patterns
add_filter('should_load_remote_block_patterns', 'my_custom_filter');

function my_custom_filter() {
    // Your custom filtering logic here
    return 'modified_value';
}

Source Code Context

wp-includes/block-patterns.php:306 - How this hook is used in WordPress core
<?php
 301   * @since 6.3.0 Add 'pattern-directory/theme' to the pattern's 'source'.
 302   * @access private
 303   */
 304  function _register_remote_theme_patterns() {
 305  	/** This filter is documented in wp-includes/block-patterns.php */
 306  	if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) {
 307  		return;
 308  	}
 309  
 310  	if ( ! wp_theme_has_theme_json() ) {
 311  		return;

PHP Documentation

<?php
/**
 * Registers patterns from Pattern Directory provided by a theme's
 * `theme.json` file.
 *
 * @since 6.0.0
 * @since 6.2.0 Normalized the pattern from the API (snake_case) to the
 *              format expected by `register_block_pattern()` (camelCase).
 * @since 6.3.0 Add 'pattern-directory/theme' to the pattern's 'source'.
 * @access private
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 0
  • File: wp-includes/block-patterns.php
Related Hooks

Related hooks will be displayed here in future updates.