Skip to content

Instantly share code, notes, and snippets.

@bwps
Forked from gaupoit/create_private_link.php
Last active May 2, 2021 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwps/577a06d2f1f6a063a2e856da167fdc18 to your computer and use it in GitHub Desktop.
Save bwps/577a06d2f1f6a063a2e856da167fdc18 to your computer and use it in GitHub Desktop.
How to create a private link with Prevent Direct Access WordPress Plugin
@gaupoit
Copy link

gaupoit commented May 2, 2021

<?php
if ( class_exists( 'PDA_Private_Link_Services' ) ) {
    //669 is attachment's id.
    return PDA_Private_Link_Services::create_private_link( 669, array(
      'expired_days'    => 5,
      'limit_downloads' => 3,
      'url' => 'hello-pda'
    ) );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment