WP_VIEWCUSTOMPOST::view_post()


Source

File: src/integrations/wp/triggers/wp-viewcustompost.php

	public function view_post() {

		global $post;
		if ( $post ) {


			$user_id = get_current_user_id();

			$args                    = [
				'code'    => $this->trigger_code,
				'meta'    => $this->trigger_meta,
				'post_id' => $post->ID,
				'user_id' => $user_id,
			];
			$post_type               = get_post_type_object( $post->post_type );
			$args['post_type_label'] = $post_type->labels->singular_name;

			$arr = Automator()->maybe_add_trigger_entry( $args, false );
			if ( $arr ) {
				foreach ( $arr as $result ) {
					if ( true === $result['result'] ) {
						$result['args']['post_type_label'] = $post_type->labels->singular_name;
						Automator()->maybe_trigger_complete( $result['args'] );
					}
				}
			}
		}
	}