lundi 2 mars 2015

How to convert raw url to hyperlink?


I have a custom field with raw urls and I want to convert them to hyperlinks. So I used this code:



<?php $text = get_post_meta( get_the_ID(), 'Links', TRUE );
echo make_clickable( $text ); ?>


The problem with this code is it doesn't work with urls that contains spaces in them. For example raw url is



http://ift.tt/1AOGqtX] Toaru Kagaku no Railgun S - 24 [FF6EFAC3].mkv



The converted url into a hyperlink appeared as



http://ift.tt/1AOGqtX] Toaru Kagaku no Railgun S - 24 [FF6EFAC3].mkv



Any way to fix this by including the spaces in the url?





Aucun commentaire:

Enregistrer un commentaire