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.
Return Return
(bool)
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;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0-beta.1 | Introduced. |