delete_noptin_subscriber( int $subscriber )

Deletes a subscriber


Parameters Parameters

$subscriber

(int) (Required) The subscriber being deleted


Top ↑

Source Source

File: includes/subscriber.php

function delete_noptin_subscriber( $subscriber ) {
	global $wpdb;

	/**
     * Fires immediately before a subscriber is deleted from the database.
     *
     * @since 1.2.4
     *
     * @param int      $subscriber       ID of the subscriber to delete.
     */
	do_action( 'delete_noptin_subscriber', $subscriber );

	// Maybe delete WP User connection.
	$user_id = get_noptin_subscriber_meta ( (int) $subscriber, 'wp_user_id', true );
	if ( ! empty( $user_id ) ) {
		delete_user_meta ( $user_id, 'noptin_subscriber_id' );
	}

	clear_noptin_subscriber_cache( $subscriber );

	$table  = get_noptin_subscribers_table_name();
	$table2 = get_noptin_subscribers_meta_table_name();

	// Delete the subscriber...
	$true1 = $wpdb->delete( $table, array( 'id' => $subscriber ), '%d' );

	// ... and its meta data.
	$true2 = $wpdb->delete( $table2, array( 'noptin_subscriber_id' => $subscriber ), '%d' );

	return $true1 && $true2;
}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.1.0Introduced.

Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation