Hooks and Filters

Available WordPress hooks and filters provided by RakuWP for customization.

What Are Hooks?

RakuWP integrates with WordPress using the standard hook system. Actions let you run custom code at specific points, while filters let you modify data before it is used.

Available Actions

rakuwp_loaded

Fires after the RakuWP plugin has fully initialized and all enabled services are loaded.

add_action('rakuwp_loaded', function() {
    // RakuWP is ready
});

rakuwp_license_validated

Fires after a successful license validation, passing the license data array.

add_action('rakuwp_license_validated', function($license_data) {
    // $license_data['plan'], $license_data['status'], etc.
});

rakuwp_service_enabled

Fires when a service module is activated on the site.

add_action('rakuwp_service_enabled', function($service_slug) {
    // A service was just enabled
});

Available Filters

rakuwp_api_timeout

Filter the timeout (in seconds) for API requests to the panel server. Default is 15 seconds.

add_filter('rakuwp_api_timeout', function($timeout) {
    return 30; // Increase to 30 seconds
});

rakuwp_cache_duration

Filter how long (in seconds) the plugin caches API responses locally. Default is 3600 (1 hour).

add_filter('rakuwp_cache_duration', function($seconds) {
    return 1800; // Cache for 30 minutes instead
});

rakuwp_service_settings

Filter the settings for a specific service module before they are applied.

add_filter('rakuwp_service_settings', function($settings, $service_slug) {
    if ($service_slug === 'performance') {
        $settings['cache_enabled'] = true;
    }
    return $settings;
}, 10, 2);

Best Practices

  • Always check if RakuWP is active before using its hooks: if (defined('RAKUWP_VERSION'))
  • Use priority parameters to control execution order when multiple callbacks are registered
  • Keep hook callbacks lightweight — heavy operations should be deferred or cached