| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Blocks API: WP_Block class 4 * 5 * @package WordPress 6 * @since 5.5.0 7 */ 8 9 /** 10 * Class representing a parsed instance of a block. 11 * 12 * @since 5.5.0 13 * @property array $attributes 14 */ 15 #[AllowDynamicProperties] 16 class WP_Block { 17 18 /** 19 * Original parsed array representation of block. 20 * 21 * @since 5.5.0 22 * @var array 23 */ 24 public $parsed_block; 25 26 /** 27 * Name of block. 28 * 29 * @example "core/paragraph" 30 * 31 * @since 5.5.0 32 * @var string|null 33 */ 34 public $name; 35 36 /** 37 * Block type associated with the instance. 38 * 39 * @since 5.5.0 40 * @var WP_Block_Type 41 */ 42 public $block_type; 43 44 /** 45 * Block context values. 46 * 47 * @since 5.5.0 48 * @var array 49 */ 50 public $context = array(); 51 52 /** 53 * All available context of the current hierarchy. 54 * 55 * @since 5.5.0 56 * @var array 57 */ 58 protected $available_context = array(); 59 60 /** 61 * Block type registry. 62 * 63 * @since 5.9.0 64 * @var WP_Block_Type_Registry 65 */ 66 protected $registry; 67 68 /** 69 * List of inner blocks (of this same class) 70 * 71 * @since 5.5.0 72 * @var WP_Block_List 73 */ 74 public $inner_blocks = array(); 75 76 /** 77 * Resultant HTML from inside block comment delimiters after removing inner 78 * blocks. 79 * 80 * @example "...Just <!-- wp:test /--> testing..." -> "Just testing..." 81 * 82 * @since 5.5.0 83 * @var string 84 */ 85 public $inner_html = ''; 86 87 /** 88 * List of string fragments and null markers where inner blocks were found 89 * 90 * @example array( 91 * 'inner_html' => 'BeforeInnerAfter', 92 * 'inner_blocks' => array( block, block ), 93 * 'inner_content' => array( 'Before', null, 'Inner', null, 'After' ), 94 * ) 95 * 96 * @since 5.5.0 97 * @var array 98 */ 99 public $inner_content = array(); 100 101 /** 102 * Constructor. 103 * 104 * Populates object properties from the provided block instance argument. 105 * 106 * The given array of context values will not necessarily be available on 107 * the instance itself, but is treated as the full set of values provided by 108 * the block's ancestry. This is assigned to the private `available_context` 109 * property. Only values which are configured to consumed by the block via 110 * its registered type will be assigned to the block's `context` property. 111 * 112 * @since 5.5.0 113 * 114 * @param array $block { 115 * An associative array of a single parsed block object. See WP_Block_Parser_Block. 116 * 117 * @type string|null $blockName Name of block. 118 * @type array $attrs Attributes from block comment delimiters. 119 * @type array $innerBlocks List of inner blocks. An array of arrays that 120 * have the same structure as this one. 121 * @type string $innerHTML HTML from inside block comment delimiters. 122 * @type array $innerContent List of string fragments and null markers where inner blocks were found. 123 * } 124 * @param array $available_context Optional array of ancestry context values. 125 * @param WP_Block_Type_Registry $registry Optional block type registry. 126 */ 127 public function __construct( $block, $available_context = array(), $registry = null ) { 128 $this->parsed_block = $block; 129 $this->name = $block['blockName']; 130 131 if ( is_null( $registry ) ) { 132 $registry = WP_Block_Type_Registry::get_instance(); 133 } 134 135 $this->registry = $registry; 136 137 $this->block_type = $registry->get_registered( $this->name ); 138 139 $this->available_context = $available_context; 140 141 $this->refresh_context_dependents(); 142 } 143 144 /** 145 * Updates the context for the current block and its inner blocks. 146 * 147 * The method updates the context of inner blocks, if any, by passing down 148 * any context values the block provides (`provides_context`). 149 * 150 * If the block has inner blocks, the method recursively processes them by creating new instances of `WP_Block` 151 * for each inner block and updating their context based on the block's `provides_context` property. 152 * 153 * @since 6.8.0 154 */ 155 public function refresh_context_dependents() { 156 /* 157 * Merging the `$context` property here is not ideal, but for now needs to happen because of backward compatibility. 158 * Ideally, the `$context` property itself would not be filterable directly and only the `$available_context` would be filterable. 159 * However, this needs to be separately explored whether it's possible without breakage. 160 */ 161 $this->available_context = array_merge( $this->available_context, $this->context ); 162 163 if ( ! empty( $this->block_type->uses_context ) ) { 164 foreach ( $this->block_type->uses_context as $context_name ) { 165 if ( array_key_exists( $context_name, $this->available_context ) ) { 166 $this->context[ $context_name ] = $this->available_context[ $context_name ]; 167 } 168 } 169 } 170 171 $this->refresh_parsed_block_dependents(); 172 } 173 174 /** 175 * Updates the parsed block content for the current block and its inner blocks. 176 * 177 * This method sets the `inner_html` and `inner_content` properties of the block based on the parsed 178 * block content provided during initialization. It ensures that the block instance reflects the 179 * most up-to-date content for both the inner HTML and any string fragments around inner blocks. 180 * 181 * If the block has inner blocks, this method initializes a new `WP_Block_List` for them, ensuring the 182 * correct content and context are updated for each nested block. 183 * 184 * @since 6.8.0 185 */ 186 public function refresh_parsed_block_dependents() { 187 if ( ! empty( $this->parsed_block['innerBlocks'] ) ) { 188 $child_context = $this->available_context; 189 190 if ( ! empty( $this->block_type->provides_context ) ) { 191 foreach ( $this->block_type->provides_context as $context_name => $attribute_name ) { 192 if ( array_key_exists( $attribute_name, $this->attributes ) ) { 193 $child_context[ $context_name ] = $this->attributes[ $attribute_name ]; 194 } 195 } 196 } 197 198 $this->inner_blocks = new WP_Block_List( $this->parsed_block['innerBlocks'], $child_context, $this->registry ); 199 } 200 201 if ( ! empty( $this->parsed_block['innerHTML'] ) ) { 202 $this->inner_html = $this->parsed_block['innerHTML']; 203 } 204 205 if ( ! empty( $this->parsed_block['innerContent'] ) ) { 206 $this->inner_content = $this->parsed_block['innerContent']; 207 } 208 } 209 210 /** 211 * Returns a value from an inaccessible property. 212 * 213 * This is used to lazily initialize the `attributes` property of a block, 214 * such that it is only prepared with default attributes at the time that 215 * the property is accessed. For all other inaccessible properties, a `null` 216 * value is returned. 217 * 218 * @since 5.5.0 219 * 220 * @param string $name Property name. 221 * @return array|null Prepared attributes, or null. 222 */ 223 public function __get( $name ) { 224 if ( 'attributes' === $name ) { 225 $this->attributes = $this->parsed_block['attrs'] ?? 226 array(); 227 228 if ( ! is_null( $this->block_type ) ) { 229 $this->attributes = $this->block_type->prepare_attributes_for_render( $this->attributes ); 230 } 231 232 return $this->attributes; 233 } 234 235 return null; 236 } 237 238 /** 239 * Processes the block bindings and updates the block attributes with the values from the sources. 240 * 241 * A block might contain bindings in its attributes. Bindings are mappings 242 * between an attribute of the block and a source. A "source" is a function 243 * registered with `register_block_bindings_source()` that defines how to 244 * retrieve a value from outside the block, e.g. from post meta. 245 * 246 * This function will process those bindings and update the block's attributes 247 * with the values coming from the bindings. 248 * 249 * ### Example 250 * 251 * The "bindings" property for an Image block might look like this: 252 * 253 * ```json 254 * { 255 * "metadata": { 256 * "bindings": { 257 * "title": { 258 * "source": "core/post-meta", 259 * "args": { "key": "text_custom_field" } 260 * }, 261 * "url": { 262 * "source": "core/post-meta", 263 * "args": { "key": "url_custom_field" } 264 * } 265 * } 266 * } 267 * } 268 * ``` 269 * 270 * The above example will replace the `title` and `url` attributes of the Image 271 * block with the values of the `text_custom_field` and `url_custom_field` post meta. 272 * 273 * @since 6.5.0 274 * @since 6.6.0 Handle the `__default` attribute for pattern overrides. 275 * @since 6.7.0 Return any updated bindings metadata in the computed attributes. 276 * 277 * @return array The computed block attributes for the provided block bindings. 278 */ 279 private function process_block_bindings() { 280 $block_type = $this->name; 281 $parsed_block = $this->parsed_block; 282 $computed_attributes = array(); 283 $supported_block_attributes = get_block_bindings_supported_attributes( $block_type ); 284 285 // If the block doesn't have the bindings property, isn't one of the supported 286 // block types, or the bindings property is not an array, return the block content. 287 if ( 288 empty( $supported_block_attributes ) || 289 empty( $parsed_block['attrs']['metadata']['bindings'] ) || 290 ! is_array( $parsed_block['attrs']['metadata']['bindings'] ) 291 ) { 292 return $computed_attributes; 293 } 294 295 $bindings = $parsed_block['attrs']['metadata']['bindings']; 296 297 /* 298 * If the default binding is set for pattern overrides, replace it 299 * with a pattern override binding for all supported attributes. 300 */ 301 if ( 302 isset( $bindings['__default']['source'] ) && 303 'core/pattern-overrides' === $bindings['__default']['source'] 304 ) { 305 $updated_bindings = array(); 306 307 /* 308 * Build a binding array of all supported attributes. 309 * Note that this also omits the `__default` attribute from the 310 * resulting array. 311 */ 312 foreach ( $supported_block_attributes as $attribute_name ) { 313 // Retain any non-pattern override bindings that might be present. 314 $updated_bindings[ $attribute_name ] = $bindings[ $attribute_name ] ?? array( 'source' => 'core/pattern-overrides' ); 315 } 316 $bindings = $updated_bindings; 317 /* 318 * Update the bindings metadata of the computed attributes. 319 * This ensures the block receives the expanded __default binding metadata when it renders. 320 */ 321 $computed_attributes['metadata'] = array_merge( 322 $parsed_block['attrs']['metadata'], 323 array( 'bindings' => $bindings ) 324 ); 325 } 326 327 foreach ( $bindings as $attribute_name => $block_binding ) { 328 // If the attribute is not in the supported list, process next attribute. 329 if ( ! in_array( $attribute_name, $supported_block_attributes, true ) ) { 330 continue; 331 } 332 // If no source is provided, or that source is not registered, process next attribute. 333 if ( ! isset( $block_binding['source'] ) || ! is_string( $block_binding['source'] ) ) { 334 continue; 335 } 336 337 $block_binding_source = get_block_bindings_source( $block_binding['source'] ); 338 if ( null === $block_binding_source ) { 339 continue; 340 } 341 342 // Adds the necessary context defined by the source. 343 if ( ! empty( $block_binding_source->uses_context ) ) { 344 foreach ( $block_binding_source->uses_context as $context_name ) { 345 if ( array_key_exists( $context_name, $this->available_context ) ) { 346 $this->context[ $context_name ] = $this->available_context[ $context_name ]; 347 } 348 } 349 } 350 351 $source_args = ! empty( $block_binding['args'] ) && is_array( $block_binding['args'] ) ? $block_binding['args'] : array(); 352 $source_value = $block_binding_source->get_value( $source_args, $this, $attribute_name ); 353 354 // If the value is not null, process the HTML based on the block and the attribute. 355 if ( ! is_null( $source_value ) ) { 356 $computed_attributes[ $attribute_name ] = $source_value; 357 } 358 } 359 360 return $computed_attributes; 361 } 362 363 /** 364 * Depending on the block attribute name, replace its value in the HTML based on the value provided. 365 * 366 * @since 6.5.0 367 * 368 * @param string $block_content Block content. 369 * @param string $attribute_name The attribute name to replace. 370 * @param mixed $source_value The value used to replace in the HTML. 371 * @return string The modified block content. 372 */ 373 private function replace_html( string $block_content, string $attribute_name, $source_value ) { 374 $block_type = $this->block_type; 375 if ( ! isset( $block_type->attributes[ $attribute_name ]['source'] ) ) { 376 return $block_content; 377 } 378 379 // Depending on the attribute source, the processing will be different. 380 switch ( $block_type->attributes[ $attribute_name ]['source'] ) { 381 case 'html': 382 case 'rich-text': 383 $block_reader = self::get_block_bindings_processor( $block_content ); 384 385 // TODO: Support for CSS selectors whenever they are ready in the HTML API. 386 // In the meantime, support comma-separated selectors by exploding them into an array. 387 $selectors = explode( ',', $block_type->attributes[ $attribute_name ]['selector'] ); 388 // Add a bookmark to the first tag to be able to iterate over the selectors. 389 $block_reader->next_tag(); 390 $block_reader->set_bookmark( 'iterate-selectors' ); 391 392 foreach ( $selectors as $selector ) { 393 // If the parent tag, or any of its children, matches the selector, replace the HTML. 394 if ( strcasecmp( $block_reader->get_tag(), $selector ) === 0 || $block_reader->next_tag( 395 array( 396 'tag_name' => $selector, 397 ) 398 ) ) { 399 // TODO: Use `WP_HTML_Processor::set_inner_html` method once it's available. 400 $block_reader->release_bookmark( 'iterate-selectors' ); 401 $block_reader->replace_rich_text( wp_kses_post( $source_value ) ); 402 return $block_reader->get_updated_html(); 403 } else { 404 $block_reader->seek( 'iterate-selectors' ); 405 } 406 } 407 $block_reader->release_bookmark( 'iterate-selectors' ); 408 return $block_content; 409 410 case 'attribute': 411 $amended_content = new WP_HTML_Tag_Processor( $block_content ); 412 if ( ! $amended_content->next_tag( 413 array( 414 // TODO: build the query from CSS selector. 415 'tag_name' => $block_type->attributes[ $attribute_name ]['selector'], 416 ) 417 ) ) { 418 return $block_content; 419 } 420 $amended_content->set_attribute( $block_type->attributes[ $attribute_name ]['attribute'], $source_value ); 421 return $amended_content->get_updated_html(); 422 423 default: 424 return $block_content; 425 } 426 } 427 428 private static function get_block_bindings_processor( string $block_content ) { 429 $internal_processor_class = new class('', WP_HTML_Processor::CONSTRUCTOR_UNLOCK_CODE) extends WP_HTML_Processor { 430 /** 431 * Replace the rich text content between a tag opener and matching closer. 432 * 433 * When stopped on a tag opener, replace the content enclosed by it and its 434 * matching closer with the provided rich text. 435 * 436 * @param string $rich_text The rich text to replace the original content with. 437 * @return bool True on success. 438 */ 439 public function replace_rich_text( $rich_text ) { 440 if ( $this->is_tag_closer() || ! $this->expects_closer() ) { 441 return false; 442 } 443 444 $depth = $this->get_current_depth(); 445 $tag_name = $this->get_tag(); 446 447 $this->set_bookmark( '_wp_block_bindings' ); 448 // The bookmark names are prefixed with `_` so the key below has an extra `_`. 449 $tag_opener = $this->bookmarks['__wp_block_bindings']; 450 $start = $tag_opener->start + $tag_opener->length; 451 452 // Find matching tag closer. 453 while ( $this->next_token() && $this->get_current_depth() >= $depth ) { 454 } 455 456 if ( ! $this->is_tag_closer() || $tag_name !== $this->get_tag() ) { 457 return false; 458 } 459 460 $this->set_bookmark( '_wp_block_bindings' ); 461 $tag_closer = $this->bookmarks['__wp_block_bindings']; 462 $end = $tag_closer->start; 463 464 $this->lexical_updates[] = new WP_HTML_Text_Replacement( 465 $start, 466 $end - $start, 467 $rich_text 468 ); 469 470 return true; 471 } 472 }; 473 474 return $internal_processor_class::create_fragment( $block_content ); 475 } 476 477 /** 478 * Generates the render output for the block. 479 * 480 * @since 5.5.0 481 * @since 6.5.0 Added block bindings processing. 482 * 483 * @global WP_Post $post Global post object. 484 * 485 * @param array $options { 486 * Optional options object. 487 * 488 * @type bool $dynamic Defaults to 'true'. Optionally set to false to avoid using the block's render_callback. 489 * } 490 * @return string Rendered block output. 491 */ 492 public function render( $options = array() ) { 493 global $post; 494 495 $before_wp_enqueue_scripts_count = did_action( 'wp_enqueue_scripts' ); 496 497 // Capture the current assets queues. 498 $before_styles_queue = wp_styles()->queue; 499 $before_scripts_queue = wp_scripts()->queue; 500 $before_script_modules_queue = wp_script_modules()->get_queue(); 501 502 /* 503 * There can be only one root interactive block at a time because the rendered HTML of that block contains 504 * the rendered HTML of all its inner blocks, including any interactive block. 505 */ 506 static $root_interactive_block = null; 507 /** 508 * Filters whether Interactivity API should process directives. 509 * 510 * @since 6.6.0 511 * 512 * @param bool $enabled Whether the directives processing is enabled. 513 */ 514 $interactivity_process_directives_enabled = apply_filters( 'interactivity_process_directives', true ); 515 if ( 516 $interactivity_process_directives_enabled && null === $root_interactive_block && ( 517 ( isset( $this->block_type->supports['interactivity'] ) && true === $this->block_type->supports['interactivity'] ) || 518 ! empty( $this->block_type->supports['interactivity']['interactive'] ) 519 ) 520 ) { 521 $root_interactive_block = $this; 522 } 523 524 $options = wp_parse_args( 525 $options, 526 array( 527 'dynamic' => true, 528 ) 529 ); 530 531 // Process the block bindings and get attributes updated with the values from the sources. 532 $computed_attributes = $this->process_block_bindings(); 533 if ( ! empty( $computed_attributes ) ) { 534 // Merge the computed attributes with the original attributes. 535 $this->attributes = array_merge( $this->attributes, $computed_attributes ); 536 } 537 538 $is_dynamic = $options['dynamic'] && $this->name && null !== $this->block_type && $this->block_type->is_dynamic(); 539 $block_content = ''; 540 541 if ( ! $options['dynamic'] || empty( $this->block_type->skip_inner_blocks ) ) { 542 $index = 0; 543 544 foreach ( $this->inner_content as $chunk ) { 545 if ( is_string( $chunk ) ) { 546 $block_content .= $chunk; 547 } else { 548 $inner_block = $this->inner_blocks[ $index ]; 549 $parent_block = $this; 550 551 /** This filter is documented in wp-includes/blocks.php */ 552 $pre_render = apply_filters( 'pre_render_block', null, $inner_block->parsed_block, $parent_block ); 553 554 if ( ! is_null( $pre_render ) ) { 555 $block_content .= $pre_render; 556 } else { 557 $source_block = $inner_block->parsed_block; 558 $inner_block_context = $inner_block->context; 559 560 /** This filter is documented in wp-includes/blocks.php */ 561 $inner_block->parsed_block = apply_filters( 'render_block_data', $inner_block->parsed_block, $source_block, $parent_block ); 562 563 /** This filter is documented in wp-includes/blocks.php */ 564 $inner_block->context = apply_filters( 'render_block_context', $inner_block->context, $inner_block->parsed_block, $parent_block ); 565 566 /* 567 * The `refresh_context_dependents()` method already calls `refresh_parsed_block_dependents()`. 568 * Therefore the second condition is irrelevant if the first one is satisfied. 569 */ 570 if ( $inner_block->context !== $inner_block_context ) { 571 $inner_block->refresh_context_dependents(); 572 } elseif ( $inner_block->parsed_block !== $source_block ) { 573 $inner_block->refresh_parsed_block_dependents(); 574 } 575 576 $block_content .= $inner_block->render(); 577 } 578 579 ++$index; 580 } 581 } 582 } 583 584 if ( ! empty( $computed_attributes ) && ! empty( $block_content ) ) { 585 foreach ( $computed_attributes as $attribute_name => $source_value ) { 586 $block_content = $this->replace_html( $block_content, $attribute_name, $source_value ); 587 } 588 } 589 590 if ( $is_dynamic ) { 591 $global_post = $post; 592 $parent = WP_Block_Supports::$block_to_render; 593 594 WP_Block_Supports::$block_to_render = $this->parsed_block; 595 596 $block_content = (string) call_user_func( $this->block_type->render_callback, $this->attributes, $block_content, $this ); 597 598 WP_Block_Supports::$block_to_render = $parent; 599 600 $post = $global_post; 601 } 602 603 if ( ( ! empty( $this->block_type->script_handles ) ) ) { 604 foreach ( $this->block_type->script_handles as $script_handle ) { 605 wp_enqueue_script( $script_handle ); 606 } 607 } 608 609 if ( ! empty( $this->block_type->view_script_handles ) ) { 610 foreach ( $this->block_type->view_script_handles as $view_script_handle ) { 611 wp_enqueue_script( $view_script_handle ); 612 } 613 } 614 615 if ( ! empty( $this->block_type->view_script_module_ids ) ) { 616 foreach ( $this->block_type->view_script_module_ids as $view_script_module_id ) { 617 wp_enqueue_script_module( $view_script_module_id ); 618 } 619 } 620 621 /* 622 * For Core blocks, these styles are only enqueued if `wp_should_load_separate_core_block_assets()` returns 623 * true. Otherwise these `wp_enqueue_style()` calls will not have any effect, as the Core blocks are relying on 624 * the combined 'wp-block-library' stylesheet instead, which is unconditionally enqueued. 625 */ 626 if ( ( ! empty( $this->block_type->style_handles ) ) ) { 627 foreach ( $this->block_type->style_handles as $style_handle ) { 628 wp_enqueue_style( $style_handle ); 629 } 630 } 631 632 if ( ( ! empty( $this->block_type->view_style_handles ) ) ) { 633 foreach ( $this->block_type->view_style_handles as $view_style_handle ) { 634 wp_enqueue_style( $view_style_handle ); 635 } 636 } 637 638 /** 639 * Filters the content of a single block. 640 * 641 * @since 5.0.0 642 * @since 5.9.0 The `$instance` parameter was added. 643 * 644 * @param string $block_content The block content. 645 * @param array $block The full block, including name and attributes. 646 * @param WP_Block $instance The block instance. 647 */ 648 $block_content = apply_filters( 'render_block', $block_content, $this->parsed_block, $this ); 649 650 /** 651 * Filters the content of a single block. 652 * 653 * The dynamic portion of the hook name, `$name`, refers to 654 * the block name, e.g. "core/paragraph". 655 * 656 * @since 5.7.0 657 * @since 5.9.0 The `$instance` parameter was added. 658 * 659 * @param string $block_content The block content. 660 * @param array $block The full block, including name and attributes. 661 * @param WP_Block $instance The block instance. 662 */ 663 $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this ); 664 665 if ( $root_interactive_block === $this ) { 666 // The root interactive block has finished rendering. Time to process directives. 667 $block_content = wp_interactivity_process_directives( $block_content ); 668 $root_interactive_block = null; 669 } 670 671 // Capture the new assets enqueued during rendering, and restore the queues the state prior to rendering. 672 $after_styles_queue = wp_styles()->queue; 673 $after_scripts_queue = wp_scripts()->queue; 674 $after_script_modules_queue = wp_script_modules()->get_queue(); 675 676 /* 677 * As a very special case, a dynamic block may in fact include a call to wp_head() (and thus wp_enqueue_scripts()), 678 * in which all of its enqueued assets are targeting wp_footer. In this case, nothing would be printed, but this 679 * shouldn't indicate that the just-enqueued assets should be dequeued due to it being an empty block. 680 */ 681 $just_did_wp_enqueue_scripts = ( did_action( 'wp_enqueue_scripts' ) !== $before_wp_enqueue_scripts_count ); 682 683 $has_new_styles = ( $before_styles_queue !== $after_styles_queue ); 684 $has_new_scripts = ( $before_scripts_queue !== $after_scripts_queue ); 685 $has_new_script_modules = ( $before_script_modules_queue !== $after_script_modules_queue ); 686 687 // Dequeue the newly enqueued assets with the existing assets if the rendered block was empty & wp_enqueue_scripts did not fire. 688 if ( 689 ! $just_did_wp_enqueue_scripts && 690 ( $has_new_styles || $has_new_scripts || $has_new_script_modules ) && 691 ( 692 trim( $block_content ) === '' && 693 /** 694 * Filters whether to enqueue assets for a block which has no rendered content. 695 * 696 * @since 6.9.0 697 * 698 * @param bool $enqueue Whether to enqueue assets. 699 * @param string $block_name Block name. 700 */ 701 ! (bool) apply_filters( 'enqueue_empty_block_content_assets', false, $this->name ) 702 ) 703 ) { 704 foreach ( array_diff( $after_styles_queue, $before_styles_queue ) as $handle ) { 705 wp_dequeue_style( $handle ); 706 } 707 foreach ( array_diff( $after_scripts_queue, $before_scripts_queue ) as $handle ) { 708 wp_dequeue_script( $handle ); 709 } 710 foreach ( array_diff( $after_script_modules_queue, $before_script_modules_queue ) as $handle ) { 711 wp_dequeue_script_module( $handle ); 712 } 713 } 714 715 return $block_content; 716 } 717 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue May 5 08:20:14 2026 | Cross-referenced by PHPXref |