Created
April 14, 2015 23:35
-
-
Save LinzardMac/d4bcdef8a0e0371af52a to your computer and use it in GitHub Desktop.
How to add query variables to WP URL
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
// create your variable, add your "key" called event_event, and define what the value should be | |
//for front end | |
$edit_post = add_query_arg( 'edit_event', $user_post->ID, site_url('/edit-events/') ); | |
//for admin | |
$edit_post = add_query_arg( 'edit_event', $user_post->ID, admin_url('admin.php?page=example') ); | |
// then simply do this for your link | |
<a href="<?php echo $edit_post; ?>" title="edit event"><?php echo $user_post->post_title; ?></a> | |
// then get the value to create whatever query you want | |
$passed_id = $_GET['edit_event'] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment