Created
July 23, 2013 16:57
-
-
Save WerdsWords/6064070 to your computer and use it in GitHub Desktop.
#16: page_link
This file contains 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' ) && $post_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
There's a typo in there:
$post_id
instead of$page_id
. I've fixed it in my fork: https://gist.github.com/JDGrimes/6065006