Get The Posts Page URL Dynamically in WordPress

Get Posts Page URL Dynamically in WordPress.

function knight_get_post_page_url() {
if( ‘page’ == get_option( ‘show_on_front’ ) ) {

return get_permalink( get_option(‘page_for_posts’ ) );

} else {

return home_url();

}
}

simply echo knight_get_post_page_url(); to get link or store in variable then echo your choice !!

Leave a comment

Your email address will not be published. Required fields are marked *

Loading...