Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: hooked_block

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
900            * @since 6.5.0
901            *
902            * @param array|null                      $parsed_hooked_block The parsed block array for the given hooked block type, or null to suppress the block.
903            * @param string                          $hooked_block_type   The hooked block type name.
904            * @param string                          $relative_position   The relative position of the hooked block.
905            * @param array                           $parsed_anchor_block The anchor block, in parsed block array format.
906            * @param WP_Block_Template|WP_Post|array $context             The block template, template part, `wp_navigation` post type,
907            *                                                             or pattern that the anchor block belongs to.
908            */
909           $parsed_hooked_block = apply_filters( 'hooked_block', $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
910
911           /**
912            * Filters the parsed block array for a given hooked block.
913            *
914            * The dynamic portion of the hook name, `$hooked_block_type`, refers to the block type name of the specific hooked block.
915            *
916            * @since 6.5.0
917            *
918            * @param array|null                      $parsed_hooked_block The parsed block array for the given hooked block type, or null to suppress the block.
 
Line Code
971      foreach ( $hooked_block_types as $index => $hooked_block_type ) {
972           $parsed_hooked_block = array(
973                'blockName'    => $hooked_block_type,
974                'attrs'        => array(),
975                'innerBlocks'  => array(),
976                'innerContent' => array(),
977           );
978
979           /** This filter is documented in wp-includes/blocks.php */
980           $parsed_hooked_block = apply_filters( 'hooked_block', $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
981
982           /** This filter is documented in wp-includes/blocks.php */
983           $parsed_hooked_block = apply_filters( "hooked_block_{$hooked_block_type}", $parsed_hooked_block, $hooked_block_type, $relative_position, $parsed_anchor_block, $context );
984
985           if ( null === $parsed_hooked_block ) {
986                unset( $hooked_block_types[ $index ] );
987           }
988      }
989