Source View: the_permalink

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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
18      /**
19       * Filter the display of the permalink for the current post.
20       *
21       * @since 1.5.0
22       * @since 4.4.0 Added the `$post` parameter.
23       *
24       * @param string      $permalink The permalink for the current post.
25       * @param int|WP_Post $post      Post ID, WP_Post object, or 0. Default 0.
26       */
27      echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) );
28 }
29
30 /**
31  * Retrieve trailing slash string, if blog set for adding trailing slashes.
32  *
33  * Conditionally adds a trailing slash if the permalink structure has a trailing
34  * slash, strips the trailing slash if not. The string is passed through the
35  * 'user_trailingslashit' filter. Will remove trailing slash from string, if
36  * blog is not set to have them.