You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by OlaIola December 9, 2024
I found out that the idea of query vars is difficult to grasp, and even experienced developers have difficulties with it.
I tried to explain the correct usage with the following example from the core but didn't succeed.
So, hopefully, there is someone who can explain it better.
add_rewrite_tag( '%sitemap%', '([^?]+)' );
add_rewrite_rule( '^wp-sitemap\.xml$', 'index.php?sitemap=index', 'top' );
add_rewrite_rule(
'^wp-sitemap-([a-z]+?)-(\d+?)\.xml$',
'index.php?sitemap=$matches[1]&paged=$matches[2]',
'top'
);
// Some other place
if ( get_query_var( 'sitemap' ) ) {
$sitemap = sanitize_text_field( get_query_var( 'sitemap' ) );
// ...
}
So, it looks like this idea needs more explanation about its usage and when it is just unnecessary haste.
Discussed in #358
Originally posted by OlaIola December 9, 2024
I found out that the idea of query vars is difficult to grasp, and even experienced developers have difficulties with it.
I tried to explain the correct usage with the following example from the core but didn't succeed.
So, hopefully, there is someone who can explain it better.
So, it looks like this idea needs more explanation about its usage and when it is just unnecessary haste.
Example I have:
file1.php
file2.php
The text was updated successfully, but these errors were encountered: