ap_deactivate_addon( string $addon_name )

Description #

Deactivate addons.

Parameters #

  • $addon_name
    string (Required) Addons file name.

Source #

File: includes/functions.php

function ap_deactivate_addon( $addon_name ) {
	if ( ! ap_is_addon_active( $addon_name ) ) {
		return false;
	}

	$opt        = get_option( 'anspress_addons', array() );
	$all_addons = ap_get_addons();
	$addon_name = wp_normalize_path( $addon_name );

	if ( isset( $all_addons[ $addon_name ] ) ) {
		unset( $opt[ $addon_name ] );
		update_option( 'anspress_addons', $opt );
		do_action( 'ap_addon_deactivated', $addon_name );

		// Delete cache.
		wp_cache_delete( 'addons', 'anspress' );

		return true;
	}

	return false;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment