get blog page url in WordPress

The blog page on my WordPress website is set to be a different page other than the home page. I want to get the link to this blog page from any other pages.

How can I get blog page url?


You can use get_option of page_for_posts to get the page ID to either assign it to a variable or to echo it.

<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>

For more information of the default get_option visit: Option Reference

<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>">

$posts_page_url is the url to blog page and $posts_page_title is the page title

$posts_page_id = get_option( 'page_for_posts');
$posts_page = get_page( $posts_page_id);
$posts_page_title = $posts_page->post_title;
$posts_page_url = get_page_uri($posts_page_id  );

More details refer the link -

use this code:

<?php echo '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">Our Blog</a>'; ?>

We can use get_post_type_archive_link since WordPress 4.5

get_post_type_archive_link( 'post' );

Need Your Help

A good database modeling tool?


Could you guys recommend me a good db modeling tool? Mainly for SQL Server...