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.

i have a Wordpress site that has the main page set to a specific template.

www.mydomain.com -> main_page_template

I am trying to pass in some params to my main URL as follows www.mydomain.com/?name=test&id=100

The issue is when passing in such parameters it always shows the list of current posts (it calls my index.php file which lists all posts) as opposed to the main page. When i dont pass parameters, it shows fine.

For all other pages, the above is fine (i.e. www.mydomain.com/page1/?name=test&id=100).

Any ideas on how i can pass parameters in yet still have it show the homepage?

Finally, i know the permalink settings cause some form of rewriting, how can i get the raw unrwitten query to the page, i.e. www.mydomain.com?p=100. This would help for debugging.

Thanks in advance,

Chris

share|improve this question
add comment

2 Answers

Do not use the terms name and id. Because they are used by WP itself hence leading to a conflict. Use something specific like ch_id and ch_name, and you'll have them in the $_GET array. Try it, I'm sure it will work!

share|improve this answer
add comment

YES! It works thank you, seems i was using registered names even when i tried it with other names than 'name' and 'id'... when i made them truly unique then it started working thank you.

In order to 'properly' get the parameters do i need use the functions:

add_filter('query_vars', 'add_my_var'); get_query_var( $var )

Apart from that, i am there! Thanks, appreciate an answer to the above and can close this question out.

Regards

share|improve this answer
    
Please do not use answers for discussion. You should be able to edit your questions and comment on answers, but you might need to register on site for it to work properly. –  Rarst Dec 20 '11 at 23:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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