Skip to content

Instantly share code, notes, and snippets.

@someguy9
Created April 29, 2022 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save someguy9/3e2d1b7f27d5322fece2b4b8add7e0ed to your computer and use it in GitHub Desktop.
Save someguy9/3e2d1b7f27d5322fece2b4b8add7e0ed to your computer and use it in GitHub Desktop.
Get a post's ID based on URL in WordPress
<?php
echo 'Returning a specific post ID from a url: '.url_to_postid( 'https://smartwp.com/my-page-url' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment