-
-
Save JDGrimes/6065006 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Return a "front page's" real permalink | |
* | |
* @param string $link The page permalink. | |
* @param int $page_id The page id. | |
* @param bool $sample Whether to return a sample permalink. | |
* | |
* @return string The filtered permalink. | |
*/ | |
function wpdocs_real_home_permalink( $link, $page_id, $sample ) { | |
if ( 'page' == get_option( 'show_on_front' ) && $page_id == get_option( 'page_on_front' ) ) | |
return _get_page_link( $page_id, false, $sample ); | |
} | |
add_filter( 'page_link', 'wpdocs_real_home_permalink', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment