Populate_From_Query::add_trigger()

Populates the POST array with the data and adds a trigger.

Contents


Return Return

(string) trigger ID


Source Source

File: src/core/classes/class-populate-from-query.php

	public static function add_trigger() {

		$_POST['recipePostID'] = self::$post->ID;
		$_POST['action']       = $_GET['action'];
		$_POST['item_code']    = $_GET['item_code'];

		$trigger_added = self::$recipe->add( '' );

		if ( ! $trigger_added->data['success'] ) {

			throw new \Exception( "Trigger couldn't be added." );

		} else {

			return $trigger_added->data['post_ID'];

		}

	}