Actions
Advanced Tools – Database Cleanup
/core/modules/class-module-advanced.php
Performance Test – Reporting
/core/modules/class-module-performance.php
Caching – Page Cache
/core/modules/class-module-page-cache.php
REST API
Module status endpoint
Clear cache endpoint

The REST API endpoints require at least the edit_posts capability and will return an error if any user without that requirement attempts to access them. If you wish to use the endpoints unprotected, you can add the following constant to your wp-config.php file:
define( 'WPHB_SKIP_REST_API_AUTH', true );

2.1 Action: wphb_delete_db_data

Copy chapter anchor to clipboard

Description

Can be used to run certain actions or configure notifications for database cleanup actions. Will fire after the database cleanup task in Advanced Tools – Database Cleanup.

Usage

add_action( ‘wphb_delete_db_data’, ‘database_cleanup’, 10, 2 );

Parameters

$type
String
Data type that was cleared from the database. Can return following values: all, revisions, drafts, trash, spam, trash_comment, expired_transients, transients.
$items
Integer
Number of items that was cleared from the database for the selected data type.

Example

2.2 Action: wphb_get_performance_report

Copy chapter anchor to clipboard

Description

Will fire after Hummingbird fetches the latest Performance report.

Usage

add_action( ‘wphb_get_performance_report’, ‘performance_report’ );

Parameters

$report
Object
Report data object. Contains id, time, url, score, score_class, title, response_code, page_stats and rule_result objects from the Page Speed report (see https://developers.google.com/speed/docs/insights/v4/reference/pagespeedapi/runpagespeed for a better description about the report format).

Example

2.3 Action: wphb_clear_page_cache

Copy chapter anchor to clipboard

Description

Allows to clear the page cache.

Usage

do_action( ‘wphb_clear_page_cache’, $page_id );

Parameters

$page_id
Integer
Optional parameter. ID of the page/post to clear the cache for. If not set, will clear all the cache.

Example

2.4 Filter: wp_hummingbird_is_active_module_minify', '__return_false

Copy chapter anchor to clipboard

Description

Disables minification when Hummingbird is active.

Example

For example, if you want to disable minification for a post page with an ID=24, you can add the following to the functions.php file:

2.5 Filter: wphb_page_cache_custom_terms

Copy chapter anchor to clipboard

Description

Allows to clear custom terms on page/post update

Example

For example, this filter can be used to clear product categories in WooCommerce, when a product is updated:

2.6 Endpoint: /status/(?P<module>[\\w-]+)

Copy chapter anchor to clipboard

Description

Allows to fetch the status of Gzip compression and Browser caching modules.

Usage

Query
http://example.com/wp-json/hummingbird/v1/status/gzip

Return

Query
http://example.com/wp-json/hummingbird/v1/status/caching

Return

2.7 Endpoint: /clear_cache/(?P<module>[\\w-]+)

Copy chapter anchor to clipboard

Description

Allow to clear the cache for various Hummingbird modules.

Usage

Query
http://example.com/wp-json/hummingbird/v1/clear_cache/

List of module names:

  • page_cache
  • performance
  • gravatar
  • minify
  • cloudflare