The conditionals. */ public static function get_conditionals() { return [ AI_Conditional::class ]; } /** * Class constructor. * * @param WPSEO_Addon_Manager $addon_manager The addon manager instance. */ public function __construct( WPSEO_Addon_Manager $addon_manager ) { $this->addon_manager = $addon_manager; } /** * Registers routes with WordPress. * * @return void */ public function register_routes() { \register_rest_route( self::ROUTE_NAMESPACE, self::ROUTE_PREFIX, [ 'methods' => 'POST', 'args' => [], 'callback' => [ $this, 'bust_subscription_cache' ], 'permission_callback' => [ $this, 'check_permissions' ], ] ); } /** * Runs the callback that busts the subscription cache. * * @return WP_REST_Response The response of the callback action. */ public function bust_subscription_cache(): WP_REST_Response { $this->addon_manager->remove_site_information_transients(); return new WP_REST_Response( 'Subscription cache successfully busted.' ); } }