PluginProbe
PatternsWP – Gutenberg Block Patterns & Page Templates Library / trunk
PatternsWP – Gutenberg Block Patterns & Page Templates Library vtrunk
trunk 1.0.0 1.0.1 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
← All changes | includes/class-patternswp-api.php +14 -0 1.0.7trunk View file →
@@ -1,5 +1,10 @@
1 1 <?php
2 +// Exit if accessed directly
3 +if (!defined('ABSPATH')) {
4 + exit;
5 +}
6 +
2 7 class PatternsWP_API_Section {
3 8
4 9 public $api_url;
5 10
@@ -236,8 +241,12 @@
236 241 }
237 242
238 243 // Return the patterns if not empty.
239 244 if (!empty($patterns)) {
245 + // Apply pattern visibility filter
246 + // error_log('[PatternsWP API] Applying filter to ' . count($patterns) . ' patterns from API');
247 + $patterns = apply_filters('patternswp_patterns', $patterns);
248 + // error_log('[PatternsWP API] Filter applied, now have ' . count($patterns) . ' patterns');
240 249 return $patterns;
241 250 } else {
242 251 // error_log('Received empty response for patterns.');
243 252 return array();
@@ -264,8 +273,13 @@
264 273 /**
265 274 * Register patterns and categories
266 275 */
267 276 private function register_patterns_and_categories( $patterns ) {
277 + // Apply pattern visibility filter before registering
278 + // error_log('[PatternsWP API] Register patterns - applying filter to ' . count($patterns) . ' patterns');
279 + $patterns = apply_filters('patternswp_patterns', $patterns);
280 + // error_log('[PatternsWP API] Register patterns - filter applied, now have ' . count($patterns) . ' patterns');
281 +
268 282 $registered_categories = array();
269 283
270 284 foreach ($patterns as $pattern) {
271 285 $categories = $pattern['categories'];