Make WordPress Core


Ignore:
Timestamp:
01/08/2016 10:00:48 PM (9 years ago)
Author:
ericlewis
Message:

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

Props jjj.
See #19902.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r36096 r36225  
    11251125        return false;
    11261126
     1127    if ( 'post' === $post_type ) {
     1128        $show_on_front = get_option( 'show_on_front' );
     1129        $page_for_posts  = get_option( 'page_for_posts' );
     1130
     1131        if ( 'page' == $show_on_front && $page_for_posts ) {
     1132            $link = get_permalink( $page_for_posts );
     1133        } else {
     1134            $link = get_home_url();
     1135        }
     1136        /** This filter is documented in wp-includes/link-template.php */
     1137        return apply_filters( 'post_type_archive_link', $link, $post_type );
     1138    }
     1139
    11271140    if ( ! $post_type_obj->has_archive )
    11281141        return false;
Note: See TracChangeset for help on using the changeset viewer.