query_vars Filter: Would You Ever Use It When $_GET is Available and You Don’t Need a ‘Pretty’ URL?
query_vars Filter: Would You Ever Use It When $_GET is Available and You Don’t Need a ‘Pretty’ URL?
query_vars Filter: Would You Ever Use It When $_GET is Available and You Don’t Need a ‘Pretty’ URL?
use query var argument as verification link?
set_query_var doesn’t seem to work on init hook
(Note to other readers: The question author and I have already discussed via chat, so I’m going straight to the code.) I think for performance reason, you should do it this way: // FIRST PART: Get the variations which are in stock. $paged = max( 1, get_query_var( ‘paged’ ) ); $wccaf_depth = array( ’19’, ‘1’ … Read more
I manually deleted the .htaccess file and regenerated, which along with the code below, made the rewrite work. The second rewrite rule in the code below makes the pagination work properly. The .htaccess file doesn’t seem to be getting written with any rules though, but the rewrite is working now anyhow. function listen_rewrite_action() { add_rewrite_tag(‘%show%’,'([^/]*)’); … Read more
Add a rewrite endpoint instead of a rewrite rule and query var. This API function will do both of these things for you. function wpd_add_my_endpoint(){ add_rewrite_endpoint( ‘information’, EP_PAGES ); } add_action( ‘init’, ‘wpd_add_my_endpoint’ ); Now any page can have information appended to the end, and the value will be available via get_query_var(‘information’).
I’ve experienced this with several plugins of my own, while trying to display a numerical pagination for my custom post types and custom taxonomies. It’s my understanding that by using WP_Query to fetch posts from the database in your own custom way (other than the default) will prevent you from using such functions as expected. … Read more
OK, let’s first get some definitive clarification on the proper query vars. Refer to Post and Page parameters on the WP_Query codex page. name (string) – use post slug. pagename (string) – use page slug. We can confirm this with WP_Query: $args = array( ‘name’ => ‘mypage’ ); $mypage = new WP_Query( $args ); echo … Read more
WordPress can automatically add the query variables for you. Instead of directly writing the query arguments, you can use it this way: $args = array( ‘f’ => ‘j’, ‘s’ => ‘w’, ‘c’ => ‘t’ ); wp_enqueue_script( ‘param-example’, add_query_arg( $args, ‘https://domain.com/example’) ); This is your solution, since according to code reference, the return value is unescaped … Read more
The problem is that your first rule is capturing anything that begins with news/archive/. Add the $ anchor to match only news/archive/: add_rewrite_rule( ‘^news/archive/?$’, ‘index.php?post_type=news&news_archive=true’, ‘top’ ); Your pagination rule will then begin to work as-is after you flush permalinks.