Template hierarchy changes when custom post-type permalink leverages custom taxonomy
Template hierarchy changes when custom post-type permalink leverages custom taxonomy
Template hierarchy changes when custom post-type permalink leverages custom taxonomy
For those interested I got around it by doing the following add_rewrite_rule( ‘members/search/(.+?)?$’, ‘index.php?page_id=’ . $member_page_id . ‘&search=$matches[1]’, ‘top’ ); So essentially getting everything after the search then dealing that when parsing the query I then parsed the query like so from the ‘search’ query_var function wpse_set_pre_get_users( $query ){ if( ! is_admin() ){ $meta_query = … Read more
It is not possible. When wordpress is parsing the URL, pages are the lowest priority (or fallback default), which means that anything with the same url that is not a page will “win” over them. You just need to use the same code you wrote for the template of the page for the archieve. You … Read more
I solved it. To enable the new rule, save the parmalink structure. Ive tried to follow the example with news from above. function news_page_rewrite_rule() { // Get the URL of the page listing out the news. // Here I use the Advanced Custom Fields plugin. $news_page_url = get_field(‘_news_page’, ‘options’); if (empty($news_page_url)) return; // Get the … Read more
Multiple Permalink Patterns for one page
You should use ‘post_type_link’ hook and register post type ‘project’ with (‘with_front’ => true) parameters ‘rewrite’ => array(‘slug’ => $slug, “with_front” => true), ==================================or===================================== add_rewrite_rule(‘^project/([0-9a-z]+)/?$’, ‘index.php?project=$matches[1]’, ‘top’); ==================================================================== function post_type_link_hook($link, $post) { add_rewrite_tag(‘%url_id%’,'([^&]+)’); if (‘projects’ == get_post_type($post)) { $urlId = get_post_meta($post->ID, ‘url_id’, true); //Lets go to get the parent cartoon-series name return str_replace(‘%url_id%’, $urlId, $link); … Read more
Own query vars are not displayed
add_rewrite_rule should choose where to write your rules to internal array of rewrite_rules or to .htaccess. If I understand logic behind this code SSLA_PLUGIN_URL is something like http://www.example.com/wp-content/plugins/plugin/… in this case you should check your .htaccess (in case if you using apache), because all external rules goes there. You can continue to debug your redirections … Read more
This is not how rewrite_rules works in WordPress. You miss two things. Match. It has $1, but in reality (take a look to example), you need to work with $matches. Your Query Var. You using q, but its not wp native or declared in example code. You can use one of the public ones or … Read more
a way to support totally different url structure