Editing the variables in a custom URL

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

Customize category URL

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

Change the search URL

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