Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

MAILCHIMP_TOKENS::is_recipe_or_rest()

Check if its from recipe page or from automator rest and not doing heartbeat.


Return Return

(Uncanny_Automatorboolean.)


Source Source

File: src/integrations/mailchimp/tokens/mailchimp-tokens.php

	private function is_recipe_or_rest() {

		if (
			isset( $_REQUEST['action'] ) && //phpcs:ignore WordPress.Security.NonceVerification.Recommended
			(
				'heartbeat' === (string) sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) || //phpcs:ignore WordPress.Security.NonceVerification.Recommended
				'wp-remove-post-lock' === (string) sanitize_text_field( wp_unslash( $_REQUEST['action'] ) )  //phpcs:ignore WordPress.Security.NonceVerification.Recommended
			)
		) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
			// if it's heartbeat, post lock actions bail
			return false;
		}

		if ( ! Automator()->helpers->recipe->is_edit_page() && ! Automator()->helpers->recipe->is_rest() ) {
			// If not automator edit page or rest call, bail
			return false;
		}

		return true;

	}