admin管理员组文章数量:1435859
I am new in WordPress.
I want to get user details on frontend without login in WordPress when the user types his name in browser URL (Like example/{user-name})
and hit enter, User redirect a new page like example/{user-name} or example/user/{user-name}
Please, anyone, help me how to complete this task.
Thanks in advance
I am new in WordPress.
I want to get user details on frontend without login in WordPress when the user types his name in browser URL (Like example/{user-name})
and hit enter, User redirect a new page like example/{user-name} or example/user/{user-name}
Please, anyone, help me how to complete this task.
Thanks in advance
Share Improve this question asked Mar 20, 2019 at 7:09 Rakesh PatidarRakesh Patidar 433 bronze badges 2- How are you implementing this is it through API or it is a page? – Pratik bhatt Commented Mar 20, 2019 at 10:50
- I am implementing on the frontend for the visitor can access normal information about admin. Visitor hit admin name in URL then get information. – Rakesh Patidar Commented Mar 20, 2019 at 10:56
1 Answer
Reset to default 0"Users" are basically "authors" in WordPress so those pages are available at example/author/{user-name}/
(with or without the trailing slash) and what you are looking for is actually to change the "author permalink base" for the URL rewrite. eg:
add_action( 'init', 'set_custom_author_base' );
function set_custom_author_base() {
global $wp_rewrite;
$wp_rewrite->author_base = 'user';
}
You can then add (or modify) an author.php
template in your child theme directory to output what you would like to show of the user (but of course not sharing private user info in public URLs like this.)
Of course this is a simple example, it might be easier to do it with a plugin like this if you want to keep the /author/
for some roles but change it for others.
本文标签: redirectHow to get user details by name
版权声明:本文标题:redirect - How to get user details by name 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745673470a2669709.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论