I have created a page "profile" that when visited with get variable of user id like:


Then it will display the profile details of user id 1. Now I want to rewrite …


… to …


How to accomplish this?

  1. Create an endpoint for EP_ROOT named profile.
  2. In your callback handler use get_user_by( 'slug', get_query_var( 'profile' ) ) to find the user data.
  3. Create a template file profile.php and use locate_template( 'profile.php', TRUE ) to load it.
  4. In your template show the user data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.