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 |
---|---|
66 | $supports_core_patterns = get_theme_support( 'core-block-patterns' ); |
67 |
|
68 | /** |
69 | * Filter to disable remote block patterns. |
70 | * |
71 | * @since 5.8.0 |
72 | * |
73 | * @param bool $should_load_remote |
74 | */ |
75 | $should_load_remote = apply_filters( 'should_load_remote_block_patterns', true ); |
76 |
|
77 | if ( $supports_core_patterns && $should_load_remote ) { |
78 | $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); |
79 | $core_keyword_id = 11; // 11 is the ID for "core". |
80 | $request->set_param( 'keyword', $core_keyword_id ); |
81 | $response = rest_do_request( $request ); |
82 | if ( $response->is_error() ) { |
83 | return; |
84 | } |
Line | Code |
94 | /** |
95 | * Register `Featured` (category) patterns from wordpress.org/patterns. |
96 | * |
97 | * @since 5.9.0 |
98 | */ |
99 | function _load_remote_featured_patterns() { |
100 | $supports_core_patterns = get_theme_support( 'core-block-patterns' ); |
101 |
|
102 | /** This filter is documented in wp-includes/block-patterns.php */ |
103 | $should_load_remote = apply_filters( 'should_load_remote_block_patterns', true ); |
104 |
|
105 | if ( ! $should_load_remote || ! $supports_core_patterns ) { |
106 | return; |
107 | } |
108 |
|
109 | $request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' ); |
110 | $featured_cat_id = 26; // This is the `Featured` category id from pattern directory. |
111 | $request->set_param( 'category', $featured_cat_id ); |
112 | $response = rest_do_request( $request ); |
Line | Code |
129 | /** |
130 | * Registers patterns from Pattern Directory provided by a theme's |
131 | * `theme.json` file. |
132 | * |
133 | * @since 6.0.0 |
134 | * @access private |
135 | */ |
136 | function _register_remote_theme_patterns() { |
137 | /** This filter is documented in wp-includes/block-patterns.php */ |
138 | if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) { |
139 | return; |
140 | } |
141 |
|
142 | if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { |
143 | return; |
144 | } |
145 |
|
146 | $pattern_settings = WP_Theme_JSON_Resolver::get_theme_data()->get_patterns(); |
147 | if ( empty( $pattern_settings ) ) { |