Advertisement
kkarpieszuk

test for url_to_postid

May 8th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <pre style="margin-top: 100px"><?php
  2.     // put test urls in variable below, one url per line
  3. // IMPORTANT! make sure that when you will paste this snippet into your file
  4. // there will be no spaces/tabs before and after every url
  5. $urls = "http://localhost/konrad/32beta1/translated-page/
  6. http://localhost/konrad/32beta1/pl/only-polish/
  7. http://localhost/konrad/32beta1/pl/hello-world/
  8. http://localhost/konrad/32beta1/hello-world/
  9. http://localhost/konrad/32beta1/pl/translated-page-pl/
  10. http://localhost/konrad/32beta1/mycpt/cpt-dupl/
  11. http://localhost/konrad/32beta1/pl/mycpt/cpt-dupl/
  12. http://localhost/konrad/32beta1/mycpt/some-cpt-en/
  13. http://localhost/konrad/32beta1/pl/mycpt/some-cpt-pl/
  14. http://localhost/konrad/32beta1/2014/05/
  15. http://localhost/konrad/32beta1/mycpt/";
  16. $urls = explode("\n", $urls);
  17. foreach ($urls as $url) {
  18.     $getPostID = url_to_postid(trim($url));
  19.     echo $url . " → ";
  20.     echo $getPostID;
  21.     echo "\n";
  22. }
  23.  
  24. ?></pre>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement