Title: rest_url
Published: December 9, 2015
Last modified: February 24, 2026

---

# apply_filters( ‘rest_url’, string $url, string $path, int|null $blog_id, string $scheme )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#wp--skip-link--target)

Filters the REST URL.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#description)󠁿

Use this filter to adjust the url returned by the [get_rest_url()](https://developer.wordpress.org/reference/functions/get_rest_url/)
function.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#parameters)󠁿

 `$url`string

REST URL.

`$path`string

REST route.

`$blog_id`int|null

Blog ID.

`$scheme`string

Sanitization scheme.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'rest_url', $url, $path, $blog_id, $scheme );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api.php#L564)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api.php#L564-L564)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#related)󠁿

| Used by | Description | 
| [get_rest_url()](https://developer.wordpress.org/reference/functions/get_rest_url/)`wp-includes/rest-api.php` |

Retrieves the URL to a REST endpoint on a site.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/rest_url/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fsummer-heart-0930.chufeiyun1688.workers.dev%3A443%2Fhttps%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frest_url%2F)
before being able to contribute a note or feedback.