Forked from coffeepostal/wordpress-get-blog-posts-page-url.php
Last active
March 23, 2018 21:44
-
-
Save brentini/c38e5ce7b9de97749412a17b432a478b to your computer and use it in GitHub Desktop.
WordPress: Get Blog Posts Page URL in WordPress #wordpress
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
<?php | |
/** | |
* Get blog posts page URL. | |
* | |
* @return string The blog posts page URL. | |
*/ | |
function km_get_blog_posts_page_url() { | |
// If front page is set to display a static page, get the URL of the posts page. | |
if ( 'page' === get_option( 'show_on_front' ) ) { | |
return get_permalink( get_option( 'page_for_posts' ) ); | |
} | |
// The front page IS the posts page. Get its URL. | |
return get_home_url(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment