WordPress开发者和主题制作者的搜索引擎



the_permalink ›

Since1.2.0
已弃用n/a
the_permalink ( $post = 0 )
参数:
  • (int|WP_Post) $post Optional. Post ID or post object. Default is the global `$post`.
    Required: No
    默认:
定义在:
文档:
Change Log:
  • 4.4.0

Displays the permalink for the current post.



源码

function the_permalink( $post = 0 ) {
	/**
	 * Filters the display of the permalink for the current post.
	 *
	 * @since 1.5.0
	 * @since 4.4.0 Added the `$post` parameter.
	 *
	 * @param string      $permalink The permalink for the current post.
	 * @param int|WP_Post $post      Post ID, WP_Post object, or 0. Default 0.
	 */
	echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) );
}