LLMS_REST_Webhooks::load()

Load webhooks


Return Return

(int) Number of hooks loaded.


Top ↑

Source Source

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

	 *
	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.16
	 *
	 * @return int Number of hooks loaded.
	 */
	public function load() {

		/**
		 * Limit the number of webhooks that are loaded. By default all webhooks are loaded.
		 *
		 * @since 1.0.0-beta.1
		 * @since 1.0.0-beta.16 When retrieving the webhooks, instantiate the webhooks query passing `no_found_rows` arg as `true`,
		 *                     to improve performance (no pagination is needed).
		 * @param int $limit Number of webhooks to load. Default `null` loads all webhooks.
		 */
		$limit = apply_filters( 'llms_load_webhooks_limit', null );

		$hooks = new LLMS_REST_Webhooks_Query(
			array(
				'status'        => 'active',
				'per_page'      => $limit ? $limit : 999,
				'no_found_rows' => true,
			)
		);

		$loaded = 0;
		foreach ( $hooks->get_webhooks() as $hook ) {
			$hook->enqueue();


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.16
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.