Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/user trailingslashit


Retrieve trailing slash string, if blog 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 ‘user_trailingslashit’ filter. Will remove trailing slash from string, if blog is not set to have them.


<?php user_trailingslashit$string$type_of_string ); ?>


(string) (false) URL with or without a trailing slash.
Default: None
(string) (false) The type of URL being considered (e.g. single, category, etc) for use in the filter.
Default: None

Return Value

Adds/removes a trailing slash based on the permalink structure


Page Tags: get_all_page_ids(), get_ancestors(), get_page(), get_page_link(), get_page_by_path(), get_page_by_title(), get_page_children(), get_page_hierarchy(), get_page_uri(), get_pages(), is_page(), page_uri_index(), wp_list_pages(), wp_page_menu()

See also index of Function Reference and index of Template Tags.