LLMS_REST_Webhook::is_valid_post_action( int $post_id )

Determine if the current post-related action is valid for the webhook


Parameters Parameters

$post_id

(int) (Required) WP Post ID.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/models/class-llms-rest-webhook.php

	protected function is_valid_post_action( $post_id ) {

		$post_type = get_post_type( $post_id );

		// Check the post type is a supported post type.
		if ( ! in_array( get_post_type( $post_id ), LLMS_REST_API()->webhooks()->get_post_type_resources(), true ) ) {
			return false;
		}

		// Ensure the current action matches the resource for the current webhook.
		if ( str_replace( 'llms_', '', $post_type ) !== $this->get_resource() ) {
			return false;
		}

		return true;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.