wpseek.com
WordPress开发者和主题制作者的搜索引擎
user_trailingslashit › WordPress Function
Since2.2.0
已弃用n/a
› user_trailingslashit ( $url, $type_of_url = '' )
参数: (2) |
|
返回: |
|
定义在: |
|
文档: |
Retrieves a trailing-slashed string if the site is set for adding trailing slashes.
Conditionally adds a trailing slash if the permalink structure has a trailing slash, strips the trailing slash if not. The string is passed through the {@see 'user_trailingslashit'} filter. Will remove trailing slash from string, if site is not set to have them.Related Functions: trailingslashit, untrailingslashit, set_transient, wp_user_settings, get_user_details
源码
function user_trailingslashit( $url, $type_of_url = '' ) { global $wp_rewrite; if ( $wp_rewrite->use_trailing_slashes ) { $url = trailingslashit( $url ); } else { $url = untrailingslashit( $url ); } /** * Filters the trailing-slashed string, depending on whether the site is set to use trailing slashes. * * @since 2.2.0 * * @param string $url URL with or without a trailing slash. * @param string $type_of_url The type of URL being considered. Accepts 'single', 'single_trackback', * 'single_feed', 'single_paged', 'commentpaged', 'paged', 'home', 'feed', * 'category', 'page', 'year', 'month', 'day', 'post_type_archive'. */ return apply_filters( 'user_trailingslashit', $url, $type_of_url ); }