Title: Proposal: Also trim https urls [patch]
Last modified: November 23, 2016

---

# Proposal: Also trim https urls [patch]

 *  [sleeksorrow](https://wordpress.org/support/users/sleeksorrow/)
 * (@sleeksorrow)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/proposal-also-trim-https-urls-patch/)
 * Hi there!
 * I find it great that URLs in description and such are being trimmed. But I found
   that https urls don’t get trimmed, only http.
 * So my proposal is to extend this feature to https, too.
 * Here is my patch proposal as unified diff:
 *     ```
       --- functions.php.orig  2016-11-23 21:11:38.045831470 +0100
       +++ functions.php       2016-11-23 21:10:53.656502325 +0100
       @@ -320,8 +320,8 @@
   
                               $urlname = substr($link, $begin, $length);
   
       -                       $trimmed = (strlen($urlname) > 50 && preg_match('#^(http://|ftp://|www\.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -5) : $urlname;
       -                       $trimmed = str_replace('http://','',$trimmed);
       +                       $trimmed = (strlen($urlname) > 50 && preg_match('#^(http://|https://|ftp://|www\.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -5) : $urlname;
       +                       $trimmed = str_replace(array('http://','https://'),'',$trimmed);
   
                               $ret     = str_replace('>' . $urlname . '<', '>' . $trimmed . '<', $ret);
                       }
       ```
   

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

 *  Plugin Author [anmari](https://wordpress.org/support/users/anmari/)
 * (@anmari)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/proposal-also-trim-https-urls-patch/#post-8564942)
 * hi just letting you know I have made a note of this. Thanks – I’m just flat out
   recently and will be traveling a bit.
 *  Thread Starter [sleeksorrow](https://wordpress.org/support/users/sleeksorrow/)
 * (@sleeksorrow)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/proposal-also-trim-https-urls-patch/#post-9051659)
 * Hope you’re fine again, just a little bump here 🙂
 * Loosely related: Is there a possibility to activate/deactivate URL trimming in
   Shortcodes? The code does not look as if it is configurable. So this would be
   a wish from me 🙂
    -  This reply was modified 9 years, 2 months ago by [sleeksorrow](https://wordpress.org/support/users/sleeksorrow/).
    -  This reply was modified 9 years, 2 months ago by [sleeksorrow](https://wordpress.org/support/users/sleeksorrow/).
 *  Thread Starter [sleeksorrow](https://wordpress.org/support/users/sleeksorrow/)
 * (@sleeksorrow)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/proposal-also-trim-https-urls-patch/#post-9584560)
 * Saw you included the patch for the https URLs. Thank you! 🙂
 * Let me know if I should open a new ticket for the “trim shortcode option” wish.

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

The topic ‘Proposal: Also trim https urls [patch]’ is closed to new replies.

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

## Tags

 * [proposal](https://wordpress.org/support/topic-tag/proposal/)
 * [whishlist](https://wordpress.org/support/topic-tag/whishlist/)

 * 3 replies
 * 2 participants
 * Last reply from: [sleeksorrow](https://wordpress.org/support/users/sleeksorrow/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/proposal-also-trim-https-urls-patch/#post-9584560)
 * Status: not a support question