Rewrite custom taxonomy URL
Rewrite custom taxonomy URL
Rewrite custom taxonomy URL
add_filter( ‘post_type_link’, ‘filterslash_post_type_link’, 11, 2); function filterslash_post_type_link( $post_link, $post ){ $post_link = home_url(“/$post->post_name/”); return $post_link; }
IMHO easiest way to do the trick is use a simple rewrite rule, and demand the logic to the page, e.g. function my_custom_url() { add_rewrite_rule(‘story/([^/]+)/?’,’index.php?pagename=story&user=$matches[1]’,’top’); } add_action( ‘init’, ‘my_custom_url’ ); After that in page where you need the user id use: $userqv = get_query_var(‘user’); $user = is_numerical( $userqv ) ? $userqv : get_user_id( $userqv ); … Read more
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?
I figured this out by reading this article. It was very simple, all I had to do was: Change the $talks_cat_args[rewrite][slug] from ‘talks’ to ‘talks/category’ (which I had tried before) but missed… Make sure register_taxonomy is before register_post_type. Read the article, but it’s basically because of “how WP_Rewrite works as the process of deciphering permalinks … Read more
How to put a Custom Folder under one sub-site of Multisite WP?
Taxonomy to WordPress Permalinks of custom post type
From WPEngineer (with edits): Add the following to functions.php in your theme: function fb_change_search_url_rewrite() { if ( is_search() && ! empty( $_GET[‘s’] ) ) { wp_redirect( home_url( “/busca/?s=” ) . urlencode( get_query_var( ‘s’ ) ) ); exit(); } } add_action( ‘template_redirect’, ‘fb_change_search_url_rewrite’ ); Add the following to your htaccess file: RewriteCond %{QUERY_STRING} ^s=(.*)$ [NC] RewriteRule … Read more
As you have not mention is that post or page. If it is page. than you can check this plugin Custom Permalink Plugin. I am not sure but this plugin may help you.
Cannot modify a registered custom post type rewrite slug