From 2730dfa902b826bef562ee628e1f09a5a86e8570 Mon Sep 17 00:00:00 2001 From: David Baumwald Date: Tue, 14 Feb 2023 15:55:05 +0000 Subject: [PATCH] Themes: Use `add_action` for `pre_get_posts` hook in `_add_template_loader_filters()`. Although `add_action` and `add_filter` are internally the same, `pre_get_posts` is an action hook. This change updates the hook type to match what developers would expect when evaluating the code. Follow-up to [52316]. Props swissspidy, riccardodicurti. Fixes #57097. git-svn-id: https://develop.svn.wordpress.org/trunk@55335 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/block-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php index 4d5742a4b9..9114e717eb 100644 --- a/src/wp-includes/block-template.php +++ b/src/wp-includes/block-template.php @@ -27,7 +27,7 @@ function _add_template_loader_filters() { // Request to resolve a template. if ( isset( $_GET['_wp-find-template'] ) ) { - add_filter( 'pre_get_posts', '_resolve_template_for_new_post' ); + add_action( 'pre_get_posts', '_resolve_template_for_new_post' ); } }