Title: url_to_postid
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( ‘url_to_postid’, string $url )

## In this article

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

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

Filters the URL to derive the post ID from.

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

 `$url`string

The URL to derive the post ID from.

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

    ```php
    $url = apply_filters( 'url_to_postid', $url );
    ```

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

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

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

Examines a URL and try to determine the post ID it represents.

  |

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

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

## User Contributed Notes

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