Pages

Thursday, January 2, 2014

Wordpress-Get Post ID in functions.php

  $url = explode('?', 'http://'.$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);  
   $ID = url_to_postid($url[0]);  
   echo $ID;  

No comments:

Post a Comment