Created
April 14, 2023 12:44
-
-
Save DumahX/d955ae656978c629303c24a7deb4c60a to your computer and use it in GitHub Desktop.
Creating new pretty links through code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $prli_link, $prli_blogurl; | |
// Create the pretty link | |
$pretty_link_id = prli_create_pretty_link( | |
'https://google.com', // Target URL | |
'api-link-1', // Slug | |
'API Link', // Name of pretty link | |
'', // Description | |
0, // Group ID (no longer in use) | |
1, // Track link? (1 - yes, 0 - no) | |
1, // No follow (1 - yes, 0 - no) | |
1, // Sponsored (1 - yes, 0 - no) | |
307, // Redirect type | |
0, // Parameter forwarding (1 - yes, 0 - no) | |
); | |
// Was the pretty link created successfully? | |
if ($pretty_link_id) { | |
$pretty_link = $prli_link->getOne($pretty_link_id); | |
$pretty_link_url = $prli_blogurl . PrliUtils::get_permalink_pre_slug_uri() . $pretty_link->slug; | |
// Work with shortened URL here. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment