| Server IP : 172.67.201.108 / Your IP : 216.73.217.54 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/newmandy/wp-content/plugins/mixvisor/ |
Upload File : |
<?php
// Get the page or posts permalink via ajax
add_action('wp_ajax_get_permalink_sample', 'ajax_get_permalink_sample');
add_action('wp_ajax_nopriv_get_permalink_sample', 'ajax_get_permalink_sample');
function ajax_get_permalink_sample(){
check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
$post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
$post_name = isset($_POST['post_name'])? $_POST['post_name'] : '';
$permalink = get_sample_permalink($post_id, $post_name);
// If the get sample permalink returns html
// Of if the post_name was empty
// then just return an empty string
if ( strpos($permalink[0], '<strong>Permalink:</strong>') !== false || $post_name == '' ) {
$link = '';
}
else {
$link1 = str_replace("%postname%", $post_name, $permalink[0]);
$link = str_replace("%pagename%", $post_name, $link1);
}
echo $link;
die();
}