Created
November 19, 2018 17:26
-
-
Save Farmatique/983e9a21393778052ca9fba66a73eb67 to your computer and use it in GitHub Desktop.
Wordpress: get post id by slug
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
if ( $post = get_page_by_path( 'your-slug', OBJECT, 'your-post-type' ) ){ | |
$post_id = $post->ID; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment