I have googled a lot, but so far haven't come close to a proper solution yet. I need help with passing parameters to the homepage of a WordPress website. Here's my setup / requirements:
I use a page template (say, MCTemplate) that is set as the static front page in Settings -> Reading.
I use 'Post name' permalink structure.
I need to pass a single parameter (say, mcdata) to the static homepage (i.e., MCTemplate).
I have used the following code in functions.php, but when I pass the parameter to the homepage (e.g., http://www.example.com/?mcdata=helloword), it show a list of latest posts instead of static front page.
function mc_query_vars( $qvars ) {
$qvars[] = 'mcdata';
return $qvars;
}
add_filter( 'query_vars', 'mc_query_vars' );
Using front-page.php comes close to solving this, but in that case I cannot use a static front page. Are there any rewrite rules or anything that I should change to get it working with the above requirements? All help is appreciated.