This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Post URLs to IDs function, supports custom post types - borrowed and modified from url_to_postid() in wp-includes/rewrite.php */ | |
function bwp_url_to_postid($url) | |
{ | |
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 | |
if ( preg_match('#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values) ) { |