Own query vars are not displayed
Own query vars are not displayed
Own query vars are not displayed
WP CLI – Pass Query / URL Variable to Cron?
SOLUTION My solution was change to use http://website.com/page-name/page/1/ and http://website.com/page-name/page/2/. And when I get query_var, I decrease it and check if it is less than zero, I return it to zero. I had to use this solution because when I pass /page/1/ or when I do not pass anything, my paged returns me a zero … Read more
I think I cracked it actually! Used this snippet: <?php $custom_terms = get_terms(‘topic’); foreach($custom_terms as $custom_term) { wp_reset_query(); $args = array(‘post_type’ => ‘episodes’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘topic’, ‘field’ => ‘slug’, ‘terms’ => $custom_term->slug, ), ), ); $loop = new WP_Query($args); if($loop->have_posts()) { echo ‘<h2>’.$custom_term->name.'</h2>’; } } ?>
CPT year wise archive based on custom date Field
Custom Fields Query Vars and Rewrite not working
If your query var tags is registered properly then the following code snippet will definitely work, I’ve tested it. It’s a modified version of your code snippet. Please make sure to add the code to your functions.php file. function prefix_custom_title($title_parts) { global $wp_query; if (isset($wp_query->query_vars[‘tags’])) { $title_parts[‘title’] = $wp_query->query_vars[‘tags’]; } return $title_parts; } add_filter( ‘document_title_parts’, … Read more
You are getting a ‘page not found’ because it is exactly that, not found. What you can do is create a page, for instance, called ‘locations’ then set it up like this example.com/locations/the-hamptons => index.php?page_id=[id_of_locations]&filter=the-hamptons
If you want to perform any redirects, you have to send your header before site sends any output. admin_head is an action that allows you to print your custom code inside <head> tag of admin sites. But if it’s inside of <head>, then some output is already sent to the browser, so you can’t perform … Read more
What you need is to register your own Rewrite Rule. To do it you should use add_rewrite_rule function. function my_custom_external_rewrite_rule() { add_rewrite_rule(‘^post-type-name/([^/]+)/?’, ‘index.php?page_id=<PAGE_ID>&external_page_name=$matches[1]’, ‘top’); } add_action( ‘init’, ‘my_custom_external_rewrite_rule’ ); And you’ll have to register your custom query variable (using query_vars hook): function my_custom_external_query_var( $query_vars ) { $query_vars[] = ‘external_page_name’; return $query_vars; } add_filter( ‘query_vars’, ‘my_custom_external_query_var’ … Read more