Title: remove http://www. and https://www. from user website url info
Last modified: September 1, 2016

---

# remove http://www. and https://www. from user website url info

 *  [Kimberly](https://wordpress.org/support/users/_kimberly_/)
 * (@_kimberly_)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/remove-httpwww-and-httpswww-from-user-website-url-info-1/)
 * I found this:
 *     ```
       $input = 'www.google.co.uk/';
   
       // in case scheme relative URI is passed, e.g., //www.google.com/
       $input = trim($input, '/');
   
       // If scheme not included, prepend it
       if (!preg_match('#^http(s)?://#', $input)) {
           $input = 'http://' . $input;
       }
   
       $urlParts = parse_url($input);
   
       // remove www
       $domain = preg_replace('/^www\./', '', $urlParts['host']);
   
       echo $domain;
   
       // output: google.co.uk
       ```
   
 * But where and especially how do I place this, so the URL showing on profiles 
   will be shorter. Example:
    [https://www.facebook.com/help/notifications](https://www.facebook.com/help/notifications)
   > [facebook.com/help/notifications](https://www.facebook.com/help/notifications)
   We all know that http:// is back to the 90’s and www is gone in the most browsers,
   so why showing old URL’s, right?
 * Only the showing URL and not the hardcoded URL 🙂
 * [https://wordpress.org/plugins/amr-users/](https://wordpress.org/plugins/amr-users/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Kimberly](https://wordpress.org/support/users/_kimberly_/)
 * (@_kimberly_)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/remove-httpwww-and-httpswww-from-user-website-url-info-1/#post-7704854)
 * OR can I add a field to rename the links?
 * URL [http://www.facebook.com/name](http://www.facebook.com/name)
    NAME **My Facebook
   page** URL [http://www.twitter.com/name](http://www.twitter.com/name) NAME **
   Twitter me now!**
 *  Plugin Author [anmari](https://wordpress.org/support/users/anmari/)
 * (@anmari)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/remove-httpwww-and-httpswww-from-user-website-url-info-1/#post-7704943)
 * Hi Kimberley,
 * This add-on may help: [https://wpusersplugin.com/downloads/amr-users-plus-social/](https://wpusersplugin.com/downloads/amr-users-plus-social/)
   
   It’s well commented and should be easy to customise for own use if you want to
   change it. It includes a user_url formatting function similar to what you request
   here.
 * NOTE: While I kinda agree with you re www, there are people who believe otherwise.
   For example, see: [http://www.yes-www.org/](http://www.yes-www.org/) and I have
   encountered people whose sites are known as www…… and they do not want other 
   people to show it without the www. So the base plugin doesn’t strip what people
   entered as it assumes that is what they want. The way I see it, if people enter
   their website with the www, then they want it shown as such (else they’d leave
   the www out).
 * I suppose one could make similar argument about the protocol – it provides info(
   eg: it’s a secure site or not), which a protocol independent url does not.
 * One way around this is to have an icon as the link text instead – as per the 
   social media examples. That would also help make the field width consistent and
   more efficient.
 * Anyway the addon (v 1.1) mentioned above has very clear functions to format both
   the social media and the user url. It currently uses icons instead of link text
   for the social media stuff, but that you could change easily to what you suggest
   above.
 * Examples:
    [http://directories.wpusersplugin.com/list-with-url/](http://directories.wpusersplugin.com/list-with-url/)
   [http://directories.wpusersplugin.com/alpha-nav-list/](http://directories.wpusersplugin.com/alpha-nav-list/)
 * hope that helps

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘remove http://www. and https://www. from user website url info’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/amr-users_f6f6f4.svg)
 * [amr users](https://wordpress.org/plugins/amr-users/)
 * [Support Threads](https://wordpress.org/support/plugin/amr-users/)
 * [Active Topics](https://wordpress.org/support/plugin/amr-users/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amr-users/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amr-users/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [anmari](https://wordpress.org/support/users/anmari/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/remove-httpwww-and-httpswww-from-user-website-url-info-1/#post-7704943)
 * Status: not resolved