How to create custom content on custom page from plugin?
After more digging, I finally stumbled across what I was looking for. Using the template_include filter is working for me. Plugin Templating within WordPress
After more digging, I finally stumbled across what I was looking for. Using the template_include filter is working for me. Plugin Templating within WordPress
Only homepage working correctly, 404 error on everything else
You don’t need a custom rewrite rule to handle this, just set your taxonomy rewrite slug like: ‘rewrite’ => array( ‘slug’ => ‘projects/category/%project_cat%’ )
add_rewrite_rule not working
Try using this: if (!is_admin()) { add_rewrite_rule(‘([A-Za-z0-9])/([A-Za-z0-9])’, ‘index.php/product?subcategory=$1&product=$2’, ‘top’); add_rewrite_rule(‘([A-Za-z0-9])’, ‘index.php/categories/?cat=$1’, ‘top’); }
How to make a custom route with any-string-part/number-part pointing to an existing page?
Rewrite URL based on form input
When you register cpt and taxonomies, remove the rewrite argument completely (use the default) and then go to your dashboard, and from Settings > Permalinks set permalink structure to (Custom Structure) and type /my-custom-slug/%postname% Screenshots: The setting: The result: save changes, and everything should be just like you want.
Ok, I found the solution by myself. I forgot to access the variable via $wp_query->query_vars[‘bahn’]. It works fine now. BUT unfortunatly, the URL is still not correct shown or translated in the browser address line. It allways shows me www.mysite.com/data/rink/?bahn=BER but I would like to see www.mysite.com/data/rink/BER How can this be realized?
The conjunction of add_rewrite_rule() & add_rewrite_tag() is a little bit tricky, perhaps you could use parse_url hook what came useful for me. The code below is to catch multiple paramete=value separated with slash. Code – add_filter( ‘parse_request’, ‘wpse128790_parse_request’ ); function wpse128790_parse_request( $wp ) { $pageslug = ‘mypage’; if( isset($wp->request) && strpos($wp->request, “https://wordpress.stackexchange.com/”) ) { $requests … Read more