WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
custom htaccess rewrite rule for page

ok i made another post and i got pointed to the Rewrite API

however, when i do print_r($_GET) on the page, it echos an empty array

heres my code in my themes function.php file using the Rewrite API:

function add_video_rewrite() {
    add_rewrite_tag("%video_id%", '([^/]*)');
    add_rewrite_tag("%video_src%", '([^/]*)');
    add_rewrite_tag("%video_title%", '([^/]*)');
    add_rewrite_rule('^video/([^/]*)/([^/]*)/([^/]*)', 'video/?video_id=$matches[1]&video_src=$matches[2]&video_title=$matches[3]', 'bottom');
add_action( 'init', 'add_video_rewrite' );

im trying to get this to work for an url like this:


but when i visit that URL, my GET variables are coming up empty

it works perfect when i visit this url:


share|improve this question

marked as duplicate by Rarst Jan 21 '12 at 21:01

This question was marked as an exact duplicate of an existing question.

I gave you an answer to that at that question, no need for a new question I guess. wordpress.stackexchange.com/questions/39665/… – Rob Vermeer Jan 21 '12 at 15:10
Please edit your original question with additional details, instead of creating new one. – Rarst Jan 21 '12 at 21:01

You should use get_query_var rather than $_GET. But you will need to register you custom variables, for instance:

add_filter('query_vars', 'register_my_query_vars' );
function register_my_query_vars( $qvars ){
    //Add these query variables
    $qvars[] = 'video_id';
    $qvars[] = 'vide_title';
    $qvars[] = 'venue_src';

    return $qvars;

Then you should be able to use get_query_var('venue_id').

share|improve this answer
His queryvars are already set by using add_rewrite_tag("%video_id%", '([^/]*)'); See: codex.wordpress.org/Rewrite_API/add_rewrite_tag – Rob Vermeer Jan 21 '12 at 15:23
Thanks Rob! I wasn't aware of that. – Stephen Harris Jan 21 '12 at 15:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.