Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active October 5, 2015 22:18
Show Gist options
  • Save hissy/2886468 to your computer and use it in GitHub Desktop.
Save hissy/2886468 to your computer and use it in GitHub Desktop.
#WordPress Is current page? by page path
<?php
/*
Usage:
if ( is_current_page_by_path( '/hoge' ) ) {
// is hoge page
} else {
// is not hoge page
}
*/
function is_current_page_by_path( $path ){
$post = get_post();
$check_page = get_page_by_path( $path );
if ( $post == $check_page ) { return true; }
else { return false; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment