Title: Filter user-provided URLs?
Last modified: August 22, 2016

---

# Filter user-provided URLs?

 *  Resolved [uncleleon](https://wordpress.org/support/users/uncleleon/)
 * (@uncleleon)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/filter-user-provided-urls/)
 * I have a music website that allows users to enter their own URLs for bands and
   locations in Events Manager.
 * It is currently set up so that a user must enter the “[http://&#8221](http://&#8221);
   along with their link. For example, here’s the EM code to display a Location’s
   website link:
 *     ```
       {has_latt_location_website}
       <p><a href="#_LATT{Location Website}"><strong>View Website</strong></a></p>
       {/has_latt_location_website}
       ```
   
 * However, many people ignore the instructions and don’t include the “[http://&#8221](http://&#8221);,
   rendering the link useless. I can change the code above so that it inserts the“
   [http://&#8221](http://&#8221);, but then I have the opposite problem with people
   who DO enter it.
 * I know that a Sanitize URL option exists, but I don’t think it would work for
   this problem.
 * Ideally, I’d like to be able to include the “[http://&#8221](http://&#8221); 
   in my posting code above, then filter it from any inputted urls on the front-
   end. Any advice on how I could do that in a function?
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

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

 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/filter-user-provided-urls/#post-5879394)
 * at the moment you need to code for this like [http://snippets.webaware.com.au/snippets/events-manager-conditional-placeholders-for-custom-attributes/](http://snippets.webaware.com.au/snippets/events-manager-conditional-placeholders-for-custom-attributes/)
 *  Thread Starter [uncleleon](https://wordpress.org/support/users/uncleleon/)
 * (@uncleleon)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/filter-user-provided-urls/#post-5879423)
 * Thanks so much for the tip. I already have conditional placeholders in place 
   to hide/show certain lines.
 * I’m still pretty new at PHP. If I want to create a condition to replace the “
   [http://&#8221](http://&#8221); in a URL with blank space, what syntax would 
   I need to use?
 *  [caimin_nwl](https://wordpress.org/support/users/caimin_nwl/)
 * (@caimin_nwl)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/filter-user-provided-urls/#post-5879470)
 * Try this:
    [http://stackoverflow.com/questions/4419644/check-if-variable-starts-with-http](http://stackoverflow.com/questions/4419644/check-if-variable-starts-with-http)
 *  [cotteej](https://wordpress.org/support/users/cotteej/)
 * (@cotteej)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/filter-user-provided-urls/#post-5879549)
 * Hi uncleleon – did you resolve the issue? If possible could you share your solution
   as I am attempting to do a similar thing.

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

The topic ‘Filter user-provided URLs?’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [cotteej](https://wordpress.org/support/users/cotteej/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/filter-user-provided-urls/#post-5879549)
 * Status: resolved