Skip to content

Instantly share code, notes, and snippets.

@yeriepiscesa
Created February 25, 2021 04:40
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 yeriepiscesa/9ae3e859cbfa99f690c9568fccc974a9 to your computer and use it in GitHub Desktop.
Save yeriepiscesa/9ae3e859cbfa99f690c9568fccc974a9 to your computer and use it in GitHub Desktop.
WP - map page to whatsapp
<?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