File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 88
99namespace WP_Path_Dispatch ;
1010
11+ use WP_Query ;
12+
1113/**
1214 * Path Dispatch
1315 */
@@ -190,16 +192,19 @@ public function add_rewrite_rules() {
190192 * Trigger an action when a dispatched path is requested. Also, potentially load
191193 * a template if that was set.
192194 *
193- * @param array $query Dispatch query .
195+ * @param WP_Query $query The WP_Query instance .
194196 */
195197 public function dispatch_path ( &$ query ) {
196198 $ path = get_query_var ( 'dispatch ' );
197199 if ( $ query ->is_main_query () && $ path ) {
200+ $ args = [];
201+
198202 if ( ! empty ( $ this ->basic_paths [ $ path ] ) ) {
199203 $ args = $ this ->basic_paths [ $ path ];
200204 } elseif ( ! empty ( $ this ->rewrite_paths [ $ path ] ) ) {
201205 $ args = $ this ->rewrite_paths [ $ path ];
202206 }
207+
203208 if ( empty ( $ args ['action ' ] ) ) {
204209 do_action ( 'dispatch_path_ ' . $ path , $ args ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
205210 } else {
You can’t perform that action at this time.
0 commit comments