0

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:

mysite.com/video/102230/MTAyMjMw/FC+Emmen+v+AGOVV+ApeldoornAyMjEx/

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

it works perfect when i visit this url:

mysite.com/video/?video_id=102230&video_title=FC+Emmen+v+AGOVV+Apeldoorn&video_src=MTAyMjMw

2

1 Answer 1

0

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').

1

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