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

Function Reference: wlmapi_protect_post

Protects a post.

Parameters

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

Return

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

Example Code

<?php
     $args = array(
          'ContentIds' => array(1,96)
     );
     $posts = wlmapi_protect_post(1340726008, $args);
     print_r($posts);
?>

Example Output

Array
(
    [success] => 1
    [posts] => Array
        (
            [post] => Array
                (
                    [0] => stdClass Object
                        (
                            [ID] => 1
                            [name] => Hello world!
                        )

                    [1] => stdClass Object
                        (
                            [ID] => 96
                            [name] => Auto Reg
                        )

                )

        )

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

)

Notes

This functions returns WLMAPIMethods::protect_post($args) 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