can you tell me a sample url please?
Hello, sorry but i don’t have a live website yet,
i was developing a solution for my client and i noticed this problem.
I have something similar to this:
https://codepen.io/the_ruther4d/post/custom-query-string-vars-in-wordpress
You can replicate the problem creating a page template (page-{ID}.php), then use this function inside:
if (get_query_var('test')) {
echo "test ok";
} else {
echo "query not set";
}
if you call the page with “site.loc/page?test=value” then it wont be cached.
you can let me know when your site is live.
Sorry but i don’t have any ETA for going online with this website.
Try to create a page on your local wordpress
Inside theme directory put a file page-PAGE_ID.php where “PAGE_ID” is the id of the page you created.
Content of page-PAGE_ID.php
<?php
if (get_query_var('test')): ?>
<html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php echo get_query_var('test'); ?>
</body>
</html>
<?php else: ?>
Query not set
<?php endif;?>
functions.php
function add_custom_query_vars( $qvars ) {
$qvars[] = 'letter';
$qvars[] = 'test';
return $qvars;
}
add_filter( 'query_vars', 'add_custom_query_vars' );
Now in browser call url:
website.loc/?pagename=contacts&test=3
on the page u can see:
WP Fastest Cache file was created in 0.2534019947052 seconds, on 25-02-20 19:14:39 but every time you refresh, the date changes and no cache is created.
are you admin when you try?
no, you can try it on icognito mode with google chrome
I can test your site when it is live.