Use has_archive in get_post_type_archive_link(). See #13818

git-svn-id: http://svn.automattic.com/wordpress/trunk@16789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-12-08 07:51:40 +00:00
parent 35b4860563
commit 2fd70020ea
1 changed files with 3 additions and 3 deletions

View File

@ -836,11 +836,11 @@ function get_post_type_archive_link( $post_type ) {
if ( ! $post_type_obj = get_post_type_object( $post_type ) ) if ( ! $post_type_obj = get_post_type_object( $post_type ) )
return false; return false;
if ( ! is_array( $post_type_obj->rewrite ) || false === $post_type_obj->rewrite['archive'] ) if ( ! $post_type_obj->has_archive )
return false; return false;
if ( get_option( 'permalink_structure' ) ) { if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) {
$struct = ( true === $post_type_obj->rewrite['archive'] ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->rewrite['archive']; $struct = $post_type_obj->rewrite['slug'];
if ( $post_type_obj->rewrite['with_front'] ) if ( $post_type_obj->rewrite['with_front'] )
$struct = $wp_rewrite->front . $struct; $struct = $wp_rewrite->front . $struct;
$link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) ); $link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) );