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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745673470a4639544.html
评论列表(0条)