Created
February 25, 2021 04:40
-
-
Save yeriepiscesa/9ae3e859cbfa99f690c9568fccc974a9 to your computer and use it in GitHub Desktop.
WP - map page to whatsapp
This file contains 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 | |
add_action( 'template_redirect', function(){ | |
if( isset( $_GET['ref'] ) && $_GET['ref'] != '' ) { | |
$maps = [ | |
"Andi" => "62812345678901", | |
"Mawar" => "62856345678901", | |
"Melati" => "62818345678901", | |
]; | |
$ref = trim( $_GET['ref'] ); | |
if( isset( $maps[$ref] ) ) { | |
wp_redirect( 'https://wa.me/' . $maps[$ref] ); | |
die; | |
} | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment