Campaign

Below are the hooks found in your campaign hook. I excluded WordPress default hooks, AJAX hooks, REST hooks, and location/line references as requested.

Campaign Hooks

nextcrm/campaign/create
nextcrm/campaign/update
nextcrm/campaign/delete
nextcrm/campaign/stop

Campaign Filter Hooks

nextcrm/campaign/filter_behavior
nextcrm/campaign/status
nextcrm/campaign/schedule/status
nextcrm/campaign/editor/types
nextcrm/campaign/per_page
nextcrm/campaign/per/batch
nextcrm/emails/per/batch

Email Tag Hooks

nextcrm/tag/create
nextcrm/tag/update
nextcrm/emailtag/delete
nextcrm/emailtags/per_page

Email Template Hooks

nextcrm/emailtemplate/create
nextcrm/emailtemplate/update
nextcrm/emailtemplate/delete
nextcrm/emailtemplates/per_page

Mailbox Hooks

nextcrm/mailbox/create
nextcrm/mailbox/update
nextcrm/mailbox/delete

Preview / Email Output Hooks

nextcrm_preview_templates
nextcrm/email/cid_image_max_size
nextcrm_allowed_additional_columns

nextcrm/campaign/create

Runs after a new campaign is created successfully.

Code Ref

do_action( 'nextcrm/campaign/create', $contact_id );

In this function, $contact_id actually means the new campaign ID.

Parameters

ParameterTypeDescription
$campaign_idintNewly created campaign ID.

Example Usage

add_action('nextcrm/campaign/create', 'my_nextcrm_after_campaign_create', 10, 1);

function my_nextcrm_after_campaign_create($campaign_id) {
    error_log('New campaign created: ' . $campaign_id);

    // Example: add campaign meta
    nextcrm_set_campaign_meta($campaign_id, 'custom_created_from_hook', 'yes');
}

Use Cases

// Add default campaign meta
// Create custom campaign log
// Sync campaign with external service
// Trigger internal notification

nextcrm/campaign/update

Runs after an existing campaign is updated successfully.

Code Ref

do_action( 'nextcrm/campaign/update', $contact_id );

Again, $contact_id is actually the campaign ID.

Parameters

ParameterTypeDescription
$campaign_idintUpdated campaign ID.

Example Usage

add_action('nextcrm/campaign/update', 'my_nextcrm_after_campaign_update', 10, 1);

function my_nextcrm_after_campaign_update($campaign_id) {
    error_log('Campaign updated: ' . $campaign_id);

    // Example: clear preview cache
    delete_transient('nextcrm_campaign_preview_' . $campaign_id);
}

Use Cases

// Clear campaign cache
// Sync updated title/content
// Update custom reports
// Log campaign edit history

nextcrm/campaign/delete

Runs after a campaign is deleted. It fires for both single delete and bulk delete.

Code Ref

do_action('nextcrm/campaign/delete', $contact_id);

Bulk delete also fires this hook for each campaign ID:

do_action('nextcrm/campaign/delete', $campaign_id);

Your code also deletes campaign logs, campaign meta, and child sequences before firing this hook.

Parameters

ParameterTypeDescription
$campaign_idintDeleted campaign ID.

Example Usage

add_action('nextcrm/campaign/delete', 'my_nextcrm_after_campaign_delete', 10, 1);

function my_nextcrm_after_campaign_delete($campaign_id) {
    error_log('Campaign deleted: ' . $campaign_id);

    // Example: delete custom campaign data
    delete_option('my_custom_campaign_data_' . $campaign_id);
}

nextcrm/campaign/stop

Runs after the campaign status is changed through the stop campaign action.

Code Ref

do_action('nextcrm/campaign/stop', $id);

Parameters

ParameterTypeDescription
$campaign_idintCampaign ID that was stopped or updated.

Example Usage

add_action('nextcrm/campaign/stop', 'my_nextcrm_after_campaign_stop', 10, 1);

function my_nextcrm_after_campaign_stop($campaign_id) {
    error_log('Campaign stopped: ' . $campaign_id);
}

Improvement Suggestion

Your function also has this value:

$status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : 'stopped';

But the hook only passes $id.

Better:

do_action('nextcrm/campaign/stop', $id, $status);

Then developers can use:

add_action('nextcrm/campaign/stop', function($campaign_id, $status) {
    error_log("Campaign {$campaign_id} changed to {$status}");
}, 10, 2);

nextcrm/campaign/filter_behavior

Allows developers to customize campaign behavior filter labels used in the campaign UI.

Code Ref

'filter_campaign' => apply_filters('nextcrm/campaign/filter_behavior', [
    'total_send' => esc_html__('Delivered', 'nextcrm'),
    'total_click' => esc_html__('Clicked', 'nextcrm'),
    'total_open' => esc_html__('Opened', 'nextcrm'),
    'total_bounce' => esc_html__('Bounced', 'nextcrm'),
    'total_unsubscribe' => esc_html__('Unsubscribed', 'nextcrm'),
    'total_faild' => esc_html__('Failed', 'nextcrm'),
    'total_purchase' => esc_html__('Purchased', 'nextcrm'),
    'total' => esc_html__('Revenue', 'nextcrm'),
]),

This hook is passed into the localized ncrm_campaign JavaScript object.

Parameters

ParameterTypeDescription
$filtersarrayCampaign behavior filter labels.

Return

array

Example Usage

add_filter('nextcrm/campaign/filter_behavior', 'my_nextcrm_campaign_behavior_labels');

function my_nextcrm_campaign_behavior_labels($filters) {
    $filters['total_open'] = 'Email Opened';
    $filters['total_click'] = 'Link Clicked';
    $filters['total_purchase'] = 'Converted';

    return $filters;
}

nextcrm_allowed_additional_columns

Allows developers to control which additional contact fields are available inside campaign filters.

Code Ref

'additional_fields' => apply_filters(
    'nextcrm_allowed_additional_columns',
    ['country', 'region', 'city', 'zip', 'source_type', 'timezone', 'mobile']
),

Parameters

ParameterTypeDescription
$columnsarrayAllowed additional contact columns.

Return

array

Example Usage

add_filter('nextcrm_allowed_additional_columns', 'my_nextcrm_campaign_extra_columns');

function my_nextcrm_campaign_extra_columns($columns) {
    $columns[] = 'company_name';
    $columns[] = 'job_title';

    return $columns;
}

nextcrm/campaign/status

Allows developers to customize campaign status labels.

Code Ref

'campaign_status' => apply_filters('nextcrm/campaign/status', [
    'publish' => esc_html__('Published', 'nextcrm'),
    'sending' => esc_html__('Running', 'nextcrm'),
    'archived' => esc_html__('Archived', 'nextcrm'),
    'stopped' => esc_html__('Stopped', 'nextcrm'),
    'paused' => esc_html__('Paused', 'nextcrm'),
    'completed' => esc_html__('Completed', 'nextcrm'),
    'draft' => esc_html__('Draft', 'nextcrm'),
    'trash' => esc_html__('Trash', 'nextcrm'),
]),

It is also used when campaign list data is prepared so the status key can be shown as a readable label.

Parameters

ParameterTypeDescription
$statusesarrayCampaign status labels.

Return

array

Example Usage

add_filter('nextcrm/campaign/status', 'my_nextcrm_campaign_status_labels');

function my_nextcrm_campaign_status_labels($statuses) {
    $statuses['publish'] = 'Scheduled';
    $statuses['sending'] = 'Sending Now';
    $statuses['completed'] = 'Finished';

    return $statuses;
}

nextcrm/campaign/schedule/status

Allows developers to customize campaign schedule status labels.

Code Ref

'schedule_status' => apply_filters('nextcrm/campaign/schedule/status', [
    'onetime' => esc_html__('Onetime', 'nextcrm'),
    'schedule' => esc_html__('Recurring', 'nextcrm'),
]),

Parameters

ParameterTypeDescription
$statusesarraySchedule status labels.

Return

array

Example Usage

add_filter('nextcrm/campaign/schedule/status', 'my_nextcrm_schedule_status_labels');

function my_nextcrm_schedule_status_labels($statuses) {
    $statuses['onetime'] = 'One-Time Campaign';
    $statuses['schedule'] = 'Recurring Campaign';

    return $statuses;
}

nextcrm/campaign/editor/types

Allows developers to customize or extend campaign editor types.

Code Ref

'editor_types' => apply_filters('nextcrm/campaign/editor/types', [
    'default' => [
        'title' => esc_html__('Gutenberg', 'nextcrm'),
        'description' => esc_html__('Use the WordPress block editor to create your email campaigns.', 'nextcrm'),
        'image' => nextcrm_core()->images . 'editor/simple.png',
    ],
    'wp_editor' => [
        'title' => esc_html__('WP Classic', 'nextcrm'),
        'description' => esc_html__('Use the WordPress Classic editor to create your email campaigns.', 'nextcrm'),
        'image' => nextcrm_core()->images . 'editor/classic.png',
    ],
    'html' => [
        'title' => esc_html__('Plain HTML', 'nextcrm'),
        'description' => esc_html__('Use the plain HTML to create your email campaigns.', 'nextcrm'),
        'image' => nextcrm_core()->images . 'editor/classic_raw.png',
    ],
    'tinymc' => [
        'title' => esc_html__('HTML Editor', 'nextcrm'),
        'description' => esc_html__('Use the HTML editor to create your email campaigns.', 'nextcrm'),
        'image' => nextcrm_core()->images . 'editor/raw-html.png',
    ],
    'builder' => [
        'title' => esc_html__('Page Builder', 'nextcrm'),
        'description' => esc_html__('Use the drag & drop page  builder to create your email campaigns.', 'nextcrm'),
        'image' => nextcrm_core()->images . 'editor/plain-html.png',
    ],
]),

Parameters

ParameterTypeDescription
$editor_typesarrayList of available campaign editor types.

Return

array

Example Usage

add_filter('nextcrm/campaign/editor/types', 'my_nextcrm_custom_campaign_editor');

function my_nextcrm_custom_campaign_editor($editors) {
    $editors['custom_builder'] = [
        'title'       => 'Custom Builder',
        'description' => 'Use a custom campaign builder.',
        'image'       => plugin_dir_url(__FILE__) . 'assets/custom-builder.png',
    ];

    return $editors;
}

nextcrm/campaign/per_page

Controls the fallback campaign pagination limit when per_page is 0.

Code Ref

$per_page = ($per_page == 0) ? apply_filters('nextcrm/campaign/per_page', 10000) : $per_page;

Parameters

ParameterTypeDescription
$per_pageintDefault fallback limit. Default 10000.

Return

int

Example Usage

add_filter('nextcrm/campaign/per_page', 'my_nextcrm_campaign_per_page');

function my_nextcrm_campaign_per_page($per_page) {
    return 500;
}

Important Note

This hook may not run in the current code because $per_page is set like this before the filter:

$per_page = max(1, intval($_GET['per_page'] ?? 10));

So $per_page cannot become 0.

Better format:

$per_page = intval($_GET['per_page'] ?? 10);
$per_page = ($per_page == 0) ? apply_filters('nextcrm/campaign/per_page', 10000) : max(1, $per_page);

nextcrm/campaign/per/batch

Controls how many contacts are added to the campaign email queue per send batch.

Code Ref

$per_batch_limit = absint(apply_filters('nextcrm/campaign/per/batch', 300));

This is used inside the campaign sending process before contacts are collected and queued.

Parameters

ParameterTypeDescription
$limitintDefault batch size. Default 300.

Return

int

Example Usage

add_filter('nextcrm/campaign/per/batch', 'my_nextcrm_campaign_queue_batch');

function my_nextcrm_campaign_queue_batch($limit) {
    return 100;
}

Use Cases

// Reduce server load
// Control queue size
// Improve shared hosting compatibility
// Slow down bulk campaign preparation

nextcrm/emails/per/batch

Controls how many pending emails are processed from the email queue per processing cycle.

Code Ref

$limit = absint(apply_filters('nextcrm/emails/per/batch', $per_batch_limit));

Parameters

ParameterTypeDescription
$limitintEmail processing batch limit.

Return

int

Example Usage

add_filter('nextcrm/emails/per/batch', 'my_nextcrm_email_send_batch_limit');

function my_nextcrm_email_send_batch_limit($limit) {
    return 10;
}

Difference From nextcrm/campaign/per/batch

HookPurpose
nextcrm/campaign/per/batchControls how many contacts are added to queue.
nextcrm/emails/per/batchControls how many queued emails are sent per processing cycle.

nextcrm/emailtags/per_page

Controls fallback pagination limit for email tag identifier list.

Code Ref

$per_page = ($per_page == 0) ? apply_filters('nextcrm/emailtags/per_page', 10000) : $per_page;

Parameters

ParameterTypeDescription
$per_pageintDefault fallback limit. Default 10000.

Return

int

Example Usage

add_filter('nextcrm/emailtags/per_page', 'my_nextcrm_emailtags_per_page');

function my_nextcrm_emailtags_per_page($per_page) {
    return 200;
}

nextcrm/emailtemplates/per_page

Controls fallback pagination limit for email templates.

Code Ref

$per_page = ($per_page == 0) ? apply_filters('nextcrm/emailtemplates/per_page', 10000) : $per_page;

Parameters

ParameterTypeDescription
$per_pageintDefault fallback limit. Default 10000.

Return

int

Example Usage

add_filter('nextcrm/emailtemplates/per_page', 'my_nextcrm_emailtemplates_per_page');

function my_nextcrm_emailtemplates_per_page($per_page) {
    return 300;
}

nextcrm/emailtag/delete

Runs after an email tag identifier is deleted.

Code Ref

Single delete:

do_action('nextcrm/emailtag/delete', $contact_id);

Bulk delete:

do_action('nextcrm/emailtag/delete', $contact_ids);

In single delete, the parameter is an integer ID. In bulk delete, the parameter is an array of IDs.

Parameters

ParameterTypeDescription
$tag_idint/arrayDeleted email tag ID or IDs.

Example Usage

add_action('nextcrm/emailtag/delete', 'my_nextcrm_emailtag_deleted', 10, 1);

function my_nextcrm_emailtag_deleted($tag_id) {
    if (is_array($tag_id)) {
        foreach ($tag_id as $id) {
            error_log('Email tag deleted: ' . $id);
        }
        return;
    }

    error_log('Email tag deleted: ' . $tag_id);
}

nextcrm/tag/create

Runs after a new email tag identifier is created.

Code Ref

do_action('nextcrm/tag/create', $contact_id);

Here, $contact_id means the email tag ID, not a contact ID.

Parameters

ParameterTypeDescription
$tag_idintCreated email tag ID.

Example Usage

add_action('nextcrm/tag/create', 'my_nextcrm_email_tag_created', 10, 1);

function my_nextcrm_email_tag_created($tag_id) {
    error_log('Email tag identifier created: ' . $tag_id);
}

Naming Note

This hook name is a little confusing because:

nextcrm/tag/create

Actually belongs to email tag identifiers, not contact tags.

Better alias:

do_action('nextcrm/emailtag/create', $contact_id);

nextcrm/tag/update

Runs after an existing email tag identifier is updated.

Code Ref

do_action('nextcrm/tag/update', $contact_id);

Here, $contact_id means the email tag ID.

Parameters

ParameterTypeDescription
$tag_idintUpdated email tag ID.

Example Usage

add_action('nextcrm/tag/update', 'my_nextcrm_email_tag_updated', 10, 1);

function my_nextcrm_email_tag_updated($tag_id) {
    error_log('Email tag identifier updated: ' . $tag_id);
}

Suggested Alias

do_action('nextcrm/tag/update', $contact_id);
do_action('nextcrm/emailtag/update', $contact_id);

nextcrm/emailtemplate/create

Runs after a new email template is created.

Code Ref

do_action('nextcrm/emailtemplate/create', $contact_id);

Here, $contact_id means the template ID.

Parameters

ParameterTypeDescription
$template_idintCreated email template ID.

Example Usage

add_action('nextcrm/emailtemplate/create', 'my_nextcrm_template_created', 10, 1);

function my_nextcrm_template_created($template_id) {
    error_log('Email template created: ' . $template_id);
}

nextcrm/emailtemplate/update

Runs after an email template is updated.

Code Ref

do_action('nextcrm/emailtemplate/update', $contact_id);

Parameters

ParameterTypeDescription
$template_idintUpdated email template ID.

Example Usage

add_action('nextcrm/emailtemplate/update', 'my_nextcrm_template_updated', 10, 1);

function my_nextcrm_template_updated($template_id) {
    delete_transient('nextcrm_template_preview_' . $template_id);
}

nextcrm/emailtemplate/delete

Runs after an email template is deleted.

Code Ref

Single delete:

do_action('nextcrm/emailtemplate/delete', $contact_id);

Bulk delete:

do_action('nextcrm/emailtemplate/delete', $contact_ids);

In single delete, the parameter is an integer. In bulk delete, it is an array.

Parameters

ParameterTypeDescription
$template_idint/arrayDeleted template ID or IDs.

Example Usage

add_action('nextcrm/emailtemplate/delete', 'my_nextcrm_template_deleted', 10, 1);

function my_nextcrm_template_deleted($template_id) {
    if (is_array($template_id)) {
        foreach ($template_id as $id) {
            error_log('Template deleted: ' . $id);
        }
        return;
    }

    error_log('Template deleted: ' . $template_id);
}

nextcrm/mailbox/create

Runs after a new mailbox is created successfully.

Code Ref

do_action('nextcrm/mailbox/create', $contact_id);

Here, $contact_id means the mailbox ID.

Parameters

ParameterTypeDescription
$mailbox_idintCreated mailbox ID.

Example Usage

add_action('nextcrm/mailbox/create', 'my_nextcrm_mailbox_created', 10, 1);

function my_nextcrm_mailbox_created($mailbox_id) {
    error_log('Mailbox created: ' . $mailbox_id);
}

nextcrm/mailbox/update

Runs after an existing mailbox is updated successfully.

Code Ref

do_action('nextcrm/mailbox/update', $contact_id);

The mailbox save process validates SMTP first, optionally validates IMAP if bounce mailbox is enabled, then fires create/update hooks after saving.

Parameters

ParameterTypeDescription
$mailbox_idintUpdated mailbox ID.

Example Usage

add_action('nextcrm/mailbox/update', 'my_nextcrm_mailbox_updated', 10, 1);

function my_nextcrm_mailbox_updated($mailbox_id) {
    error_log('Mailbox updated: ' . $mailbox_id);
}

nextcrm/mailbox/delete

Runs after a mailbox is deleted.

Code Ref

do_action('nextcrm/mailbox/delete', $contact_id);

Parameters

ParameterTypeDescription
$mailbox_idintDeleted mailbox ID.

Example Usage

add_action('nextcrm/mailbox/delete', 'my_nextcrm_mailbox_deleted', 10, 1);

function my_nextcrm_mailbox_deleted($mailbox_id) {
    error_log('Mailbox deleted: ' . $mailbox_id);
}

nextcrm_preview_templates

Allows developers to modify the full preview HTML before it is printed.

Code Ref

echo apply_filters( 'nextcrm_preview_templates', $contenthtml, $id, $editor );
exit;

This runs only for preview output. Email output returns cleaned/inlined HTML before this preview filter runs.

Parameters

ParameterTypeDescription
$contenthtmlstringFull preview HTML.
$idintTemplate, campaign, or sequence ID.
$editorstringEditor type.

Return

string

Example Usage

add_filter('nextcrm_preview_templates', 'my_nextcrm_preview_badge', 10, 3);

function my_nextcrm_preview_badge($contenthtml, $id, $editor) {
    $badge = '<div style="padding:10px;background:#f0fde7;">Preview ID: ' . intval($id) . '</div>';

    return str_replace('<body>', '<body>' . $badge, $contenthtml);
}

25. nextcrm/email/cid_image_max_size

Controls the maximum size for external images downloaded for CID/email attachment handling.

Code Ref

$max_size = apply_filters('nextcrm/email/cid_image_max_size', 500 * 1024);

Parameters

ParameterTypeDescription
$max_sizeintMaximum image size in bytes. Default is 500 * 1024, around 500 KB.

Return

int

Example Usage

add_filter('nextcrm/email/cid_image_max_size', 'my_nextcrm_cid_image_size');

function my_nextcrm_cid_image_size($max_size) {
    return 1024 * 1024; // 1 MB
}

Use Cases

// Allow larger CID images
// Reduce email size
// Prevent heavy external images
// Improve deliverability

Full Non-Repeated Hook List for This Page

// Campaign lifecycle
nextcrm/campaign/create
nextcrm/campaign/update
nextcrm/campaign/delete
nextcrm/campaign/stop

// Campaign UI / settings filters
nextcrm/campaign/filter_behavior
nextcrm_allowed_additional_columns
nextcrm/campaign/status
nextcrm/campaign/schedule/status
nextcrm/campaign/editor/types

// Campaign pagination / sending controls
nextcrm/campaign/per_page
nextcrm/campaign/per/batch
nextcrm/emails/per/batch

// Email tags
nextcrm/tag/create
nextcrm/tag/update
nextcrm/emailtag/delete
nextcrm/emailtags/per_page

// Email templates
nextcrm/emailtemplate/create
nextcrm/emailtemplate/update
nextcrm/emailtemplate/delete
nextcrm/emailtemplates/per_page

// Mailbox
nextcrm/mailbox/create
nextcrm/mailbox/update
nextcrm/mailbox/delete

// Preview / email output
nextcrm_preview_templates
nextcrm/email/cid_image_max_size

Best Developer Example for Campaign Docs

/**
 * Add custom log when a NextCRM campaign is created.
 */
add_action('nextcrm/campaign/create', 'my_nextcrm_campaign_created_log', 10, 1);

function my_nextcrm_campaign_created_log($campaign_id) {
    if (empty($campaign_id)) {
        return;
    }

    nextcrm_set_campaign_meta($campaign_id, 'custom_log', [
        'message' => 'Campaign created from custom hook',
        'date'    => current_time('mysql'),
    ]);
}

Best Developer Example for Email Sending Control

/**
 * Reduce campaign email batch size for shared hosting.
 */
add_filter('nextcrm/emails/per/batch', 'my_nextcrm_safe_email_batch');

function my_nextcrm_safe_email_batch($limit) {
    return 5;
}

Next

Leave a Reply

Your email address will not be published. Required fields are marked *