1
我正在尝试更改用户配置文件的链接,而且看起来我太新手了。 链接的当前结构是:domain.com/profile/username。 我想要的是像:domain.com/username/city其中城市从wp_postmeta表Wordpress用户固定链接更改问题
我用这个函数试图采取的东西:
add_action('init', 'wpse82004_init');
function wpse82004_init()
{
global $wp_rewrite;
$city = get_user_meta(get_current_user_id(), 'city', TRUE);
$wp_rewrite->author_base = $city;
$wp_rewrite->author_structure = '/%author%' . '/' . $wp_rewrite->author_base;
}
的问题是,返回所有配置文件中当前记录的用户的城市,点击。 任何帮助,将不胜感激。由于
你不想叫'get_current_user_id()',而应该在URL解析'username'并获取其'city'值改写 – jasonslyvia
它有可能做到这一点?你能帮我吗? –
有可能使用foreach循环来获取所有ID吗? –