How to embed a new string in url?

try this add_filter( ‘rewrite_rules_array’,’my_insert_rewrite_rules’ ); add_filter( ‘query_vars’,’my_insert_query_vars’ ); function my_insert_rewrite_rules( $rules ) { $newrules = array(); $newrules[‘(.+?)/custom_post_type_slug/(.+?)/?$’] = ‘index.php?post_type=custom_post_type_slug&dynamic_string=$matches[1]&custom_post_type_slug=$matches[2]’; return $newrules + $rules; } function my_insert_query_vars( $vars ) { array_push($vars, ‘dynamic_string’); return $vars; }

“set_front” => false on custom post type breaks wp_list_categories links [closed]

The parameter you are using is wrong. There is no set_front parameter when you register a Custom Post Type. The appropriate parameter is with_front. ‘with_front’ => bool Should the permastruct be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true http://codex.wordpress.org/Function_Reference/register_post_type#Arguments

Get logged in username in wordpress url

I think this will do what you are looking for. add_action(“template_redirect”, ‘template_redirect’); function template_redirect() { global $wp; if(is_user_logged_in() && !isset($_GET[‘user’])){ $current_user= get_userdata(get_current_user_id()); wp_redirect(add_query_arg(array(‘user’=>$current_user->user_login),home_url($wp->request))); die(); } }

WP Rewrite for a custom variable

You have to use this: add_rewrite_rule( ‘resources/audience/([^/]+)/?$’, ‘index.php?pagename=resources&audience=$matches[1]’, ‘top’ ); in your init hook. Then you should add your own query variable: function add_my_var($public_query_vars) { $public_query_vars[] = ‘audience’; return $public_query_vars; } add_filter(‘query_vars’, ‘add_my_var’); Then flush rewrite rules (go to permalink settings and push “save” button). After visiting url: site.com/resources/audience/teachers/ your recources page should be shown. … Read more