Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: post_type_archive_link

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
1219           $show_on_front  = get_option( 'show_on_front' );
1220           $page_for_posts = get_option( 'page_for_posts' );
1221
1222           if ( 'page' == $show_on_front && $page_for_posts ) {
1223                $link = get_permalink( $page_for_posts );
1224           } else {
1225                $link = get_home_url();
1226           }
1227           /** This filter is documented in wp-includes/link-template.php */
1228           return apply_filters( 'post_type_archive_link', $link, $post_type );
1229      }
1230
1231      if ( ! $post_type_obj->has_archive ) {
1232           return false;
1233      }
1234
1235      if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) {
1236           $struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
1237           if ( $post_type_obj->rewrite['with_front'] ) {
 
Line Code
1246
1247      /**
1248       * Filters the post type archive permalink.
1249       *
1250       * @since 3.1.0
1251       *
1252       * @param string $link      The post type archive permalink.
1253       * @param string $post_type Post type name.
1254       */
1255      return apply_filters( 'post_type_archive_link', $link, $post_type );
1256 }
1257
1258 /**
1259  * Retrieves the permalink for a post type archive feed.
1260  *
1261  * @since 3.1.0
1262  *
1263  * @param string $post_type Post type
1264  * @param string $feed      Optional. Feed type. Possible values include 'rss2', 'atom'.