Skip to content

Conversation

@westonruter
Copy link
Member

This cherry picks the has_filter()/has_action() changes from #10449 to isolate them from the changes to wp_oembed_add_discovery_links().

Trac ticket: https://core.trac.wordpress.org/ticket/64186


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props westonruter.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter
Copy link
Member Author

Review from Gemini:

The changes introduce a new $priority parameter to the has_filter method in WP_Hook class and the has_filter and has_action functions in plugin.php. This allows checking for the existence of a filter or action at a specific priority.

Review Summary:

  • src/wp-includes/class-wp-hook.php:
    • The has_filter method now accepts an optional $priority parameter.
    • The docblock for has_filter has been updated with @since 6.9.0 Added the $priority parameter. and the @param and @return descriptions are correctly updated to reflect the new parameter and its behavior.
    • The internal logic correctly handles the new $priority parameter, including a check for is_int( $priority ) and changing the foreach loop variable to $callback_priority to avoid conflicts.
  • src/wp-includes/plugin.php:
    • The has_filter and has_action functions now accept an optional $priority parameter and pass it to the WP_Hook class's has_filter method.
    • Docblocks for both functions are updated with @since 6.9.0 Added the $priority parameter. and the @param and @return descriptions are correctly updated.
  • Test Files (tests/phpunit/tests/actions.php, tests/phpunit/tests/filters.php, tests/phpunit/tests/hooks/hasFilter.php):
    • New tests and modifications to existing tests have been added to cover the new $priority parameter functionality for has_action and has_filter.
    • @ticket 64186 has been added to the relevant test methods, which is appropriate for test files.

Overall Assessment:

The changes are well-implemented and adhere to WordPress coding standards. The docblocks are correctly updated, and the new functionality is covered by unit tests. The code remains compatible with PHP 7.2.

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61118
GitHub commit: faf3d46

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant