Wednesday, November 2, 2022
HomeWordPress Developmentphp - Add any username as hyperlink prefix and present knowledge from...

php – Add any username as hyperlink prefix and present knowledge from that particular person’s profile on wordpress pages – with no login required


Instance: www.instance.com/johndoe/sample-page/

Person with username “johndoe” has

  1. Identify discipline worth of “John Doe”
  2. E-mail discipline worth of “johndoe@electronic mail.com”
  3. Fb discipline worth of “fb.com/johndoe”
  4. Handle discipline worth of “Fundamental avenue 47 ”

Present this values on Pattern Web page through shortcode
[userdata username={read_from_url} field=email]

As soon as opened, save this username in a cookie and redirect the customer:
www.instance.com/sample-page/ –> www.instance.com/username/sample-page/

Add that USERNAME to all inner hyperlinks to keep away from redirects (from there on each energetic hyperlink on the web site to comprise the prefix)

Stay instance with the identical performance on one other wordpress web site: https://eqology.com/15499949/webshop/our-products-en/omega-3-en/
(Test CTRL+U to see all inner hyperlinks comprise the username/id prefix)

I’ve tried making 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’] however I do know it is not suppossed to work this fashion 😀

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments