Function Reference: wlmapi_protect_page

Protects a page.

Parameters

  • args (array) – An array of accepted arguments specified below:
Parameter Description Required Default
ContentIds (array) An array of page IDs to protect Required

Return

Returns a multi-dimensional array containing operation status and an array containing all protected pages.

Example Code

<?php
     $args = array(
          'ContentIds' => array(145)
     );
     $pages = wlmapi_protect_page($args);
     print_r($pages);
?>

Example Output

Array
(
    [success] => 1
    [pages] => Array
        (
            [page] => Array
                (
                    [0] => stdClass Object
                        (
                            [ID] => 145
                            [name] => Chat
                        )

                    [1] => stdClass Object
                        (
                            [ID] => 159
                            [name] => News Feed
                        )

                )

        )

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

)

Notes

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