should_load_remote_block_patterns

should_load_remote_block_patterns

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7

apply_filters('should_load_remote_block_patterns') is found 3 times:

  • /wp-includes/block-patterns.php line 228
    	 * @since 5.8.0
    	 *
    	 * @param bool $should_load_remote
    	 */
    	$should_load_remote = apply_filters( 'should_load_remote_block_patterns', true );
    
    	if ( $supports_core_patterns && $should_load_remote ) {
    		$request         = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
    		$core_keyword_id = 11; // 11 is the ID for "core".
    		$request->set_param( 'keyword', $core_keyword_id );
    		$response = rest_do_request( $request );
    
  • /wp-includes/block-patterns.php line 261
    function _load_remote_featured_patterns() {
    	$supports_core_patterns = get_theme_support( 'core-block-patterns' );
    
    	/** This filter is documented in wp-includes/block-patterns.php */
    	$should_load_remote = apply_filters( 'should_load_remote_block_patterns', true );
    
    	if ( ! $should_load_remote || ! $supports_core_patterns ) {
    		return;
    	}
    
    	$request         = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
    
  • /wp-includes/block-patterns.php line 300
     * @access private
     */
    function _register_remote_theme_patterns() {
    	/** This filter is documented in wp-includes/block-patterns.php */
    	if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) {
    		return;
    	}
    
    	if ( ! wp_theme_has_theme_json() ) {
    		return;
    	}
    

See this hook used in plugins: