Polylang breaks custom query var
-
Polylang free version 1.9.3
WordPress 4.5.3Consider the following code:
add_action( 'init', 'create_child_pages_permalinks' ); function create_child_pages_permalinks(){ add_rewrite_rule( 'services/([0-9]+)/?$', 'index.php?pagename=services&child_page_tax=test_query_var', 'top' ); } add_filter( 'query_vars', 'child_page_tax_query_var' ); function child_page_tax_query_var( $query_vars ){ $query_vars[] = 'child_page_tax'; return $query_vars; }Then, on page.php;
var_dump(get_query_var('child_page_tax'));With Polylang disabled, I get ‘test_query_var’. With Polylang enabled, I get an empty string. For some reason, Polylang is preventing me from adding a custom query var.
The real life purpose of this code is to create permalinks with a structure like /{parent_page}/{taxonomy_term}.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Polylang breaks custom query var’ is closed to new replies.