Last Updated: February 25, 2016
· gilbitron
Avatar2014 2 200

WordPress get_blog_url()

Have you ever needed to find the WordPress blog URL? Using home_url() is fine but what if your Settings > Reading options in WordPress are set to your blog having a static page (usually called “Blog”). You may need to know what the URL of that page is. So here is a quick function I came up with to find it.

if ( !function_exists( 'get_blog_url' ) ) {
    function get_blog_url(){
        if( $posts_page_id = get_option('page_for_posts') ){
            return home_url(get_page_uri($posts_page_id));
        } else {
            return home_url();
Say Thanks