Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: post_type_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

Line Code
198           $post_link = home_url( user_trailingslashit($post_link) );
199      } else {
200           if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )
201                $post_link = add_query_arg($post_type->query_var, $slug, '');
202           else
203                $post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
204           $post_link = home_url($post_link);
205      }
206
207      return apply_filters('post_type_link', $post_link, $post, $leavename, $sample);
208 }
209
210 /**
211  * Retrieve permalink from post ID.
212  *
213  * @since 1.0.0
214  *
215  * @param int $post_id Optional. Post ID.
216  * @param mixed $deprecated Not used.