|
158 | 158 | 'core/table', |
159 | 159 | 'core/textColumns', |
160 | 160 | ], |
161 | | - 'page' => [], |
| 161 | + 'page' => [ |
| 162 | + // Core blocks needed for most WordPress core patterns |
| 163 | + 'core/button', |
| 164 | + 'core/buttons', |
| 165 | + 'core/column', |
| 166 | + 'core/columns', |
| 167 | + 'core/cover', |
| 168 | + 'core/group', |
| 169 | + 'core/heading', |
| 170 | + 'core/image', |
| 171 | + 'core/media-text', |
| 172 | + 'core/paragraph', |
| 173 | + 'core/spacer', |
| 174 | + 'core/verse', |
| 175 | + // Reusable blocks |
| 176 | + 'core/block', |
| 177 | + ], |
162 | 178 | // 'page' => [ |
163 | 179 | // 'all-acf-blocks', |
164 | 180 | // 'core/paragraph', |
@@ -197,9 +213,72 @@ function debug_print_all_blocks() { |
197 | 213 | die(); |
198 | 214 | } |
199 | 215 |
|
| 216 | +/** |
| 217 | + * Debug function to print all available block patterns |
| 218 | + */ |
| 219 | +function debug_print_all_patterns() { |
| 220 | + $patterns = \WP_Block_Patterns_Registry::get_instance()->get_all_registered(); |
| 221 | + echo '<h2>Available Block Patterns:</h2>'; |
| 222 | + echo '<pre>'; |
| 223 | + foreach ( $patterns as $pattern_name => $pattern_data ) { |
| 224 | + echo "'" . esc_html( $pattern_name ) . "', // " . esc_html( $pattern_data['title'] ) . "\n"; |
| 225 | + } |
| 226 | + echo '</pre>'; |
| 227 | + die(); |
| 228 | +} |
| 229 | + |
200 | 230 | // Uncomment the following line to see all available blocks: |
201 | 231 | // add_action('init', __NAMESPACE__ . '\\debug_print_all_blocks'); |
202 | 232 |
|
| 233 | +// Uncomment the following line to see all available block patterns: |
| 234 | +// add_action('init', __NAMESPACE__ . '\\debug_print_all_patterns'); |
| 235 | + |
| 236 | +// Disable remote patterns from WordPress.org: |
| 237 | +add_filter( 'should_load_remote_block_patterns', '__return_false' ); |
| 238 | + |
| 239 | +/** |
| 240 | + * Remove unwanted core block patterns |
| 241 | + */ |
| 242 | +function remove_unwanted_core_patterns() { |
| 243 | + // Remove ALL core patterns completely |
| 244 | + remove_theme_support( 'core-block-patterns' ); |
| 245 | + |
| 246 | + // Alternative - Remove specific patterns one by one (commented out) |
| 247 | + /* |
| 248 | + $patterns_to_remove = [ |
| 249 | + // Text patterns |
| 250 | + 'core/text-two-columns', |
| 251 | + 'core/text-two-columns-with-images', |
| 252 | + 'core/text-three-columns-buttons', |
| 253 | +
|
| 254 | + // Query/Posts patterns |
| 255 | + 'core/query-standard-posts', |
| 256 | + 'core/query-medium-posts', |
| 257 | + 'core/query-small-posts', |
| 258 | + 'core/query-grid-posts', |
| 259 | + 'core/query-large-title-posts', |
| 260 | + 'core/query-offset-posts', |
| 261 | +
|
| 262 | + // Social patterns |
| 263 | + 'core/social-links-shared-background-color', |
| 264 | +
|
| 265 | + // Header patterns |
| 266 | + 'core/large-header', |
| 267 | + 'core/large-header-button', |
| 268 | +
|
| 269 | + // Quote patterns |
| 270 | + 'core/quote', |
| 271 | +
|
| 272 | + // Button patterns |
| 273 | + 'core/two-buttons', |
| 274 | + ]; |
| 275 | +
|
| 276 | + foreach ( $patterns_to_remove as $pattern ) { |
| 277 | + unregister_block_pattern( $pattern ); |
| 278 | + } |
| 279 | + */ |
| 280 | +} |
| 281 | +add_action( 'after_setup_theme', __NAMESPACE__ . '\remove_unwanted_core_patterns' ); |
203 | 282 |
|
204 | 283 | /** |
205 | 284 | * Required files |
|
0 commit comments