Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding $dirpath to pattern files filter
  • Loading branch information
webmandesign authored Apr 4, 2025
commit abf064c0ac36b7dd61e1c472478b2472b4743eff
5 changes: 3 additions & 2 deletions src/wp-includes/class-wp-theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -1865,9 +1865,10 @@ public function get_block_patterns() {
*
* @since 6.8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 6.8
* @since 6.8.0

*
* @param array $files Array of theme files found within `patterns` directory.
* @param array $files Array of theme files found within `patterns` directory.
* @param string $dirpath Path of theme `patterns` directory being scanned.
*/
$files = (array) apply_filters( 'get_block_patterns_files', $files );
$files = (array) apply_filters( 'get_block_patterns_files', $files, $dirpath );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this to be a bit more consistent with other filters in this file:

Suggested change
$files = (array) apply_filters( 'get_block_patterns_files', $files, $dirpath );
$files = (array) apply_filters( 'theme_block_pattern_files', $files, $dirpath );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting as an array could hide if someone returns the wrong type which can make it harder to debug.

Suggested change
$files = (array) apply_filters( 'get_block_patterns_files', $files, $dirpath );
$files = apply_filters( 'get_block_patterns_files', $files, $dirpath );


$dirpath = trailingslashit( $dirpath );

Expand Down
Loading