Browse: Home / Hooks /

learndash_rest_api_enabled

apply_filters( 'learndash_rest_api_enabled',  boolean $enabled,  string $post_type )

Filters whether the LearnDash REST API is enabled or not.


Description #


Parameters #

$enabled

(boolean) Whether the REST API is enabled or not.

$post_type

(string) The slug of the post type to be checked.


Source #

File: includes/rest-api/class-ld-rest-api.php


Examples #

Note: Extended code example below not guaranteed, you may need to consult with a developer

 <?php
/**
 * Example usage for learndash_rest_api_enabled filter.
 */
add_filter(
	'learndash_rest_api_enabled',
	function( $enabled, $post_type ) {
		// May add any custom logic using $enabled, $post_type.

		// Always return $enabled.
		return $enabled;
	},
	10,
	2
);