1. Home
  2. Knowledge Base
  3. API
  4. Function Reference
  5. Function Reference: wlmapi_get_protected_categories

Function Reference: wlmapi_get_protected_categories

Retrieves all categories that have been protected.

Parameters

There are no parameters for this function

Return

Returns a multi-dimensional array containing data for each protected category.

Example Code

<?php
     $categories = wlmapi_get_protected_categories();
     print_r($categories);
?>

Example Output

Array
(
    [success] => 1
    [categories] => Array
        (
            [category] => Array
                (
                    [0] => Array
                        (
                            [ID] => 9
                            [name] => Child Category I
                        )

                    [1] => Array
                        (
                            [ID] => 10
                            [name] => Child Category II
                        )

                    [2] => Array
                        (
                            [ID] => 11
                            [name] => Child Category III
                        )

                    [3] => Array
                        (
                            [ID] => 12
                            [name] => Grandchild Category I
                        )

                    [4] => Array
                        (
                            [ID] => 6
                            [name] => Parent Category I
                        )

                    [5] => Array
                        (
                            [ID] => 7
                            [name] => Parent Category II
                        )

                    [6] => Array
                        (
                            [ID] => 8
                            [name] => Parent Category III
                        )

                    [7] => Array
                        (
                            [ID] => 1
                            [name] => Uncategorized
                        )

                )

        )

    [supported_verbs] => Array
        (
            [0] => GET
            [1] => POST
        )

)

Notes

This functions returns WLMAPIMethods::get_protected_categories($level_id) in core/api-helper/class-api-methods.php

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support