Changeset 61118 for trunk/src/wp-includes/class-wp-hook.php
- Timestamp:
- 11/03/2025 11:45:40 PM (5 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-hook.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-hook.php
r60809 r61118 224 224 * 225 225 * @since 4.7.0 226 * @since 6.9.0 Added the `$priority` parameter. 226 227 * 227 228 * @param string $hook_name Optional. The name of the filter hook. Default empty. … … 229 230 * This method can be called unconditionally to speculatively check 230 231 * a callback that may or may not exist. Default false. 232 * @param int|false $priority Optional. The specific priority at which to check for the callback. 233 * Default false. 231 234 * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has 232 235 * anything registered. When checking a specific function, the priority 233 236 * of that hook is returned, or false if the function is not attached. 234 */ 235 public function has_filter( $hook_name = '', $callback = false ) { 237 * If `$callback` and `$priority` are both provided, a boolean is returned 238 * for whether the specific function is registered at that priority. 239 */ 240 public function has_filter( $hook_name = '', $callback = false, $priority = false ) { 236 241 if ( false === $callback ) { 237 242 return $this->has_filters(); … … 244 249 } 245 250 246 foreach ( $this->callbacks as $priority => $callbacks ) { 251 if ( is_int( $priority ) ) { 252 return isset( $this->callbacks[ $priority ][ $function_key ] ); 253 } 254 255 foreach ( $this->callbacks as $callback_priority => $callbacks ) { 247 256 if ( isset( $callbacks[ $function_key ] ) ) { 248 return $ priority;257 return $callback_priority; 249 258 } 250 259 }
Note: See TracChangeset
for help on using the changeset viewer.