You appear to be a bot. Output may be restricted
Description
If it's a valid Jetpack module, activate it.
Usage
$bool|WP_Error = Jetpack_Core_API_Module_Toggle_Endpoint::activate_module( $request );
Parameters
- $request
- ( string|WP_REST_Request ) required – It's a WP_REST_Request when called from endpoint /module/<slug>/* and a string when called from Jetpack_Core_API_Data->update_data. { Array of parameters received by request.
- $slug
- ( string ) required – Module slug. }
Returns
bool|WP_Error True if module was activated. Otherwise, a WP_Error instance with the corresponding error.
Source
File name: jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php
Lines:
1 to 44 of 44
public function activate_module( $request ) { $module_slug = ''; if ( ( is_array( $request ) || is_object( $request ) ) && isset( $request['slug'] ) ) { $module_slug = $request['slug']; } else { $module_slug = $request; } if ( ! Jetpack::is_module( $module_slug ) ) { return new WP_Error( 'not_found', esc_html__( 'The requested Jetpack module was not found.', 'jetpack' ), array( 'status' => 404 ) ); } if ( ! Jetpack_Plan::supports( $module_slug ) ) { return new WP_Error( 'not_supported', esc_html__( 'The requested Jetpack module is not supported by your plan.', 'jetpack' ), array( 'status' => 424 ) ); } if ( Jetpack::activate_module( $module_slug, false, false ) ) { return rest_ensure_response( array( 'code' => 'success', 'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ), ) ); } return new WP_Error( 'activation_failed', esc_html__( 'The requested Jetpack module could not be activated.', 'jetpack' ), array( 'status' => 424 ) ); }