Permalinks: Make `get_post_type_archive_link()` work for the 'post' post type.

Props jjj.
See #19902. 

Built from https://develop.svn.wordpress.org/trunk@36225


git-svn-id: http://core.svn.wordpress.org/trunk@36192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Eric Lewis 2016-01-08 22:01:26 +00:00
parent 5b4b4fc479
commit d8e6199126
2 changed files with 14 additions and 1 deletions

View File

@ -1124,6 +1124,19 @@ function get_post_type_archive_link( $post_type ) {
if ( ! $post_type_obj = get_post_type_object( $post_type ) )
return false;
if ( 'post' === $post_type ) {
$show_on_front = get_option( 'show_on_front' );
$page_for_posts = get_option( 'page_for_posts' );
if ( 'page' == $show_on_front && $page_for_posts ) {
$link = get_permalink( $page_for_posts );
} else {
$link = get_home_url();
}
/** This filter is documented in wp-includes/link-template.php */
return apply_filters( 'post_type_archive_link', $link, $post_type );
}
if ( ! $post_type_obj->has_archive )
return false;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36224';
$wp_version = '4.5-alpha-36225';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.