ss.org/browser/tags/6.5/src/wp-
includes/formatting.php#L4601) [ View on GitHub
](https://github.com/WordPress/wordpress-develop/blob/6.5/src/wp-
includes/formatting.php#L4601-L4603)

##  Related

Uses  |  Description   
---|---  
[ sanitize_url() ](https://developer.wordpress.org/reference/functions/sanitize_url/) ` wp-includes/formatting.php ` |  Sanitizes a URL for database or redirect usage.   
Used by  |  Description   
---|---  
[ WP_Scripts::do_item() ](https://developer.wordpress.org/reference/classes/wp_scripts/do_item/) ` wp-includes/class-wp-scripts.php ` |  Processes a script dependency.   
  
##  Changelog

Version  |  Description   
---|---  
[ 6.1.0 ](https://developer.wordpress.org/reference/since/6.1.0/) |  Turned into an alias for [ sanitize_url() ](https://developer.wordpress.org/reference/functions/sanitize_url/) .   
[ 2.8.0 ](https://developer.wordpress.org/reference/since/2.8.0/) |  Introduced.   
  
##  User Contributed Notes

  1. Skip to note 2 content 

[ Codex ](https://profiles.wordpress.org/codex/) [ 8 years ago
](https://developer.wordpress.org/reference/functions/esc_url_raw/#comment-1219)

[ You must log in to vote on the helpfulness of this note
](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_url_raw%2F%23comment-1219
"You must log in to vote on the helpfulness of this note") Vote results for
this note:  4  [ You must log in to vote on the helpfulness of this note
](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_url_raw%2F%23comment-1219
"You must log in to vote on the helpfulness of this note")

**Right and Wrong usage**

    
        <!-- Right -->
    $url = 'http://wordpress.org';
    $response = wp_remote_get( esc_url_raw( $url ) ); // no need to escape entities
    
    if ( ! is_wp_error( $response ) ) {
    	echo wp_remote_retrieve_body( $response );
    }
    
        <!-- Wrong! Use esc_url instead! -->
    <img src="<?php echo esc_url_raw( $url ); ?>" />
    <a href="<?php echo esc_url_raw( $url ); ?>">WordPress</a>

[ Log in to add feedback
](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_url_raw%2F%3Freplytocom%3D1219%23feedback-
editor-1219)

You must [ log in
](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fesc_url_raw%2F)
before being able to contribute a note or feedback.

  * [ About ](https://wordpress.org/about/)
  * [ News ](https://wordpress.org/news/)
  * [ Hosting ](https://wordpress.org/hosting/)
  * [ Privacy ](https://wordpress.org/about/privacy/)

  * [ Showcase ](https://wordpress.org/showcase/)
  * [ Themes ](https://wordpress.org/themes/)
  * [ Plugins ](https://wordpress.org/plugins/)
  * [ Patterns ](https://wordpress.org/patterns/)

  * [ Learn ](https://learn.wordpress.org/)
  * [ Documentation ](https://wordpress.org/documentation/)
  * [ Developers ](https://developer.wordpress.org/)
  * [ WordPress.tv  ↗  ](https://wordpress.tv/)

  * [ Get Involved ](https://make.wordpress.org/)
  * [ Events ](https://events.wordpress.org/)
  * [ Donate  ↗  ](https://wordpressfoundation.org/donate/)
  * [ Swag Store  ↗  ](https://mercantile.wordpress.org/)

  * [ WordPress.com  ↗  ](https://wordpress.com/?ref=wporg-footer)
  * [ Matt  ↗  ](https://ma.tt/)
  * [ bbPress  ↗  ](https://bbpress.org/)
  * [ BuddyPress  ↗  ](https://buddypress.org/)

[ WordPress.org  ](https://wordpress.org/) [ WordPress.org
](https://wordpress.org/)

  * [ Visit our Facebook page  ](https://www.facebook.com/WordPress/)
  * [ Visit our X (formerly Twitter) account  ](https://www.x.com/WordPress)
  * [ Visit our Instagram account  ](https://www.instagram.com/wordpress/)
  * [ Visit our LinkedIn account  ](https://www.linkedin.com/company/wordpress)
  * [ Visit our YouTube channel  ](https://www.youtube.com/wordpress)

![Code is Poetry](https://s.w.org/style