2013-05-30 64 views

回答

0

我找到了一個解決方案:

add_action('init','url_init'); 
function url_init() { 
    global $wp, $wp_rewrite; 
    $wp->add_query_var('user'); 

    //Rewrite abc.com/me/user=arvind to abc.com/me/arvind 
    //$wp_rewrite->add_rule('me/([^/]+)/?', 'index.php?pagename=me&user=$matches[1]', 'top'); 

    //Rewrite abc.com/user=arvind to abc.comm/arvind 
    $wp_rewrite->add_rule('([^/]+)/?', 'index.php?user=$matches[1]', 'top'); 

    // Once you get working, remove this next line 
    $wp_rewrite->flush_rules(false); 
}