mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Add url_to_postid filter. Props Alex King. fixes #4160
git-svn-id: http://svn.automattic.com/wordpress/trunk@5283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
49166ab920
commit
8cbe134f81
@ -64,6 +64,8 @@ function add_rewrite_endpoint($name, $places) {
|
|||||||
function url_to_postid($url) {
|
function url_to_postid($url) {
|
||||||
global $wp_rewrite;
|
global $wp_rewrite;
|
||||||
|
|
||||||
|
$url = apply_filters('url_to_postid', $url);
|
||||||
|
|
||||||
// First, check to see if there is a 'p=N' or 'page_id=N' to match against
|
// First, check to see if there is a 'p=N' or 'page_id=N' to match against
|
||||||
preg_match('#[?&](p|page_id)=(\d+)#', $url, $values);
|
preg_match('#[?&](p|page_id)=(\d+)#', $url, $values);
|
||||||
$id = intval($values[2]);
|
$id = intval($values[2]);
|
||||||
|
Loading…
Reference in New Issue
Block a user