Why not just use get_query_var() in WordPress? Code Link
// Test if the query exists at the URL if ( get_query_var('ppc') ) { // If so echo the value echo get_query_var('ppc'); }
Since get_query_var can only access query parameters available for WP_Query, to access a custom var query, such as 'ppc', you also need to register this query variable in your plugin or functions.php by adding an action during initialization:
add_action('init','add_get_val'); function add_get_val() { global $wp; $wp->add_query_var('ppc'); }
Or by adding a hook to the query_vars filter:
function add_query_vars_filter( $vars ){ $vars[] = "ppc"; return $vars; } add_filter( 'query_vars', 'add_query_vars_filter' );
Marc
source share