WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
Line | Code |
---|---|
65 | $supports_core_patterns = get_theme_support( 'core-block-patterns' ); |
66 |
|
67 | /** |
68 | * Filter to disable remote block patterns. |
69 | * |
70 | * @since 5.8.0 |
71 | * |
72 | * @param bool $should_load_remote |
73 | */ |
74 | $should_load_remote = apply_filters( 'should_load_remote_block_patterns', true ); |
75 |
|
76 | if ( $supports_core_patterns && $should_load_remote ) { |
77 | $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); |
78 | $core_keyword_id = 11; // 11 is the ID for "core". |
79 | $request->set_param( 'keyword', $core_keyword_id ); |
80 | $response = rest_do_request( $request ); |
81 | if ( $response->is_error() ) { |
82 | return; |
83 | } |
Line | Code |
93 | /** |
94 | * Register `Featured` (category) patterns from wordpress.org/patterns. |
95 | * |
96 | * @since 5.9.0 |
97 | */ |
98 | function _load_remote_featured_patterns() { |
99 | $supports_core_patterns = get_theme_support( 'core-block-patterns' ); |
100 |
|
101 | /** This filter is documented in wp-includes/block-patterns.php */ |
102 | $should_load_remote = apply_filters( 'should_load_remote_block_patterns', true ); |
103 |
|
104 | if ( ! $should_load_remote || ! $supports_core_patterns ) { |
105 | return; |
106 | } |
107 |
|
108 | $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); |
109 | $featured_cat_id = 26; // This is the `Featured` category id from pattern directory. |
110 | $request->set_param( 'category', $featured_cat_id ); |
111 | $response = rest_do_request( $request ); |
Line | Code |
132 | * @since 6.0.0 |
133 | * @access private |
134 | */ |
135 | function _register_remote_theme_patterns() { |
136 | if ( ! get_theme_support( 'core-block-patterns' ) ) { |
137 | return; |
138 | } |
139 |
|
140 | /** This filter is documented in wp-includes/block-patterns.php */ |
141 | if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) { |
142 | return; |
143 | } |
144 |
|
145 | if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { |
146 | return; |
147 | } |
148 |
|
149 | $pattern_settings = WP_Theme_JSON_Resolver::get_theme_data()->get_patterns(); |
150 | if ( empty( $pattern_settings ) ) { |