Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this 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
add comment

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

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
1  
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
add comment

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