• Resolved Richard Venancio

    (@richardvenancio)


    Hello guys, it is just a suggestion:

    On class-swpm-protection-base.php you check if the post is protected using in_array function, on a big portal with thousands posts protected this gonna have a performance issue.

    For the future if you think it worst, you could create the array as an associative array, and use isset, to check if the post is protected.

    
    $array = [
     '1548' => 1',
     '116515' => 1',
     '851312' => 1',
     '415511' => 1',
     '651322' => 1',
     '651321' => 1',
    ];
    
    return isset($array[$post_id]);
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi, thank you for reaching out to us and providing your suggestion. I have submitted a message to the developers to investigate further your code.

    Kind regards.

    Plugin Author wp.insider

    (@wpinsider-1)

    Thank you. We will check it out.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘in_array function performance’ is closed to new replies.