is_noptin_campaign( int|WP_Post $post, bool|string $campaign_type = false )

Checks if a given post is a noptin campaign.


Parameters Parameters

$post

(int|WP_Post) (Required) The post to check for.

$campaign_type

(bool|string) (Optional) Specify if you need to check for a specific campaign type.

Default value: false


Top ↑

Return Return

(bool.)


Top ↑

Source Source

File: includes/functions.php

function is_noptin_campaign( $post, $campaign_type = false ) {

	$campaign = get_post( $post );

	if ( empty( $campaign ) || 'noptin-campaign' !== $campaign->post_type ) {
		return false;
	}

	if ( empty( $campaign_type ) ) {
		return true;
	}

	return trim( $campaign_type ) === get_post_meta( $campaign->ID, 'campaign_type', true );

}

Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.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