php – Add any username as link prefix and show data from that specific user’s profile on wordpress pages – with no login required



User with username “johndoe” has

  1. Name field value of “John Doe”
  2. E-mail field value of “”
  3. Facebook field value of “”
  4. Address field value of “Main street 47 ”

Show this values on Sample Page via shortcode
[userdata username={read_from_url} field=email]

Once opened, save this username in a cookie and redirect the visitor: –>

Add that USERNAME to all internal links to avoid redirects (from there on every active link on the website to contain the prefix)

Live example with the same functionality on another wordpress site:
(Check CTRL+U to see all internal links contain the username/id prefix)

I’ve tried creating a rewrite tag and a rule for it to be put in a url param
add_rewrite_tag('%username%', '([^&]+)', 'username=");

Then use URL Params shortcode
[urlparam param=”username’] but I know it’s not suppossed to work this way 😀

0 4 weeks 2022-11-02T17:03:12-05:00 0 Answers 0 views 0

Leave an answer