acf_pro_deactivate_license()
Deactivates the registered license key. Formally ACF_Admin_Updates::deactivate_pro_licence since 5.0.0
Хуков нет.
Возвращает
Разное
. $response A wp-error instance, or an array with a boolean success key, and string message key
Использование
acf_pro_deactivate_license( $silent );
- $silent(true|false)
- Return errors rather than displaying them
По умолчанию: false
Список изменений
С версии 5.11.0 | Введена. |
Код acf_pro_deactivate_license() acf pro deactivate license ACF 6.0.4
function acf_pro_deactivate_license( $silent = false ) { // Get license key. $license = acf_pro_get_license_key( true ); // Bail early if no key. if ( ! $license ) { return false; } // Connect to API. $post = array( 'acf_license' => $license, 'wp_url' => acf_get_home_url(), ); $response = acf_updates()->request( 'v2/plugins/deactivate?p=pro', $post ); // Check response is expected JSON array (not string). if ( is_string( $response ) ) { $response = new WP_Error( 'server_error', esc_html( $response ) ); } // Display error. if ( is_wp_error( $response ) ) { if ( ! $silent ) { display_wp_activation_error( $response ); } return $response; } // Remove license key from DB. acf_pro_update_license( '' ); // Refresh plugins transient to fetch new update data. acf_updates()->refresh_plugins_transient(); $success = $response['status'] == 1; if ( ! $silent ) { $notice_class = $success ? 'info' : 'warning'; acf_add_admin_notice( acf_esc_html( $response['message'] ), $notice_class ); } // Return status array for automated activation error notices return array( 'success' => $success, 'message' => $response['message'], ); }