Escape special characters in image link

I am importing the images from XML using a plugin, it truncates the image link while importing. Some symbols are causing the images not to show in the posts. This is the image link.
What it shows is mydomain.com/wp-content/uploads/2014/03/watermark.jpeg
I need a php function which escapes the special characters in a URL. (WordPress Plugin Name: WP-ALLIMPORT)

1 Answer
1

Because based on your description, I am not sure what is your purpose doing the escape.

If you want to escape the URL, you might consider using WordPress internal esc_url() function

If you want to do some more low level control with PHP native function, you may consider urlencode() and you might have to manually urldecode() it in some cases depending on your purpose

Leave a Comment