Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function prefix_get_post_id() {
- if ( is_ssl() ) {
- $protocol = 'https://';
- } else {
- $protocol = 'http://';
- }
- if ( is_front_page() ) {
- $post_id = get_option('page_on_front');
- } else if ( is_home() ) {
- $post_id = get_option( 'page_for_posts' );
- } else {
- $post_id = url_to_postid( $protocol . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ) );
- }
- return $post_id;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement