trailingslashit( string $string )
Appends a trailing slash.
Description
Will remove trailing forward and backslashes if it exists already before adding a trailing forward slash. This prevents double slashing a string or path.
The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support.
Parameters
- $string
-
(Required) What to add the trailing slash to.
Return
(string) String with trailing slash added.
Source
File: wp-includes/formatting.php
function trailingslashit( $string ) {
return untrailingslashit( $string ) . '/';
}
Related
Uses
Uses | Description |
---|---|
wp-includes/formatting.php: untrailingslashit() |
Removes trailing forward slashes and backslashes if they exist. |
Used By
Used By | Description |
---|---|
wp-includes/general-template.php: paginate_links() |
Retrieve paginated link for archive post pages. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php: WP_REST_Terms_Controller::prepare_links() |
Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::prepare_links() |
Prepares links for the request. |
wp-includes/media.php: wp_calculate_image_srcset() |
A helper function to calculate the image sources to include in a ‘srcset’ attribute. |
wp-includes/query.php: wp_old_slug_redirect() |
Redirect old slugs to the correct permalink. |
wp-includes/class-wp-image-editor.php: WP_Image_Editor::get_output_format() |
Returns preferred mime-type and extension based on provided file’s extension and mime, or current file’s extension and mime. |
wp-includes/class-wp-image-editor.php: WP_Image_Editor::generate_filename() |
Builds an output filename based on current file, and adding proper suffix |
wp-includes/comment.php: weblog_ping() |
Send a pingback. |
wp-includes/embed.php: get_post_embed_url() |
Retrieves the URL to embed a specific post in an iframe. |
wp-includes/class-wp-admin-bar.php: WP_Admin_Bar::initialize() | |
wp-includes/link-template.php: wp_get_canonical_url() |
Returns the canonical URL for a post. |
wp-includes/link-template.php: get_comments_pagenum_link() |
Retrieves the comments page number link. |
wp-includes/link-template.php: paginate_comments_links() |
Displays or retrieves pagination links for the comments on the current post. |
wp-includes/link-template.php: get_pagenum_link() |
Retrieves the link for a page number. |
wp-includes/link-template.php: get_search_feed_link() |
Retrieves the permalink for the search results feed. |
wp-includes/link-template.php: get_post_type_archive_feed_link() |
Retrieves the permalink for a post type archive feed. |
wp-includes/link-template.php: get_post_comments_feed_link() |
Retrieves the permalink for the post comments feed. |
wp-includes/link-template.php: get_author_feed_link() |
Retrieves the feed link for a given author. |
wp-includes/link-template.php: get_term_feed_link() |
Retrieves the feed link for a term. |
wp-includes/link-template.php: user_trailingslashit() |
Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
wp-includes/link-template.php: get_attachment_link() |
Retrieves the permalink for an attachment. |
wp-includes/ms-blogs.php: update_blog_details() |
Update the details for a blog. Updates the blogs table for a given blog id. |
wp-includes/class-wp-theme.php: WP_Theme::scandir() |
Scans a directory for files of a certain extension. |
wp-includes/plugin.php: plugin_dir_path() |
Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in. |
wp-includes/plugin.php: plugin_dir_url() |
Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in. |
wp-includes/rewrite.php: url_to_postid() |
Examine a URL and try to determine the post ID it represents. |
wp-includes/post-template.php: _wp_link_page() |
Helper function for wp_link_pages(). |
wp-includes/class-wp-rewrite.php: WP_Rewrite::mod_rewrite_rules() |
Retrieves mod_rewrite-formatted rewrite rules to write to .htaccess. |
wp-includes/canonical.php: redirect_canonical() |
Redirects incoming links to the proper URL based on the site url. |
wp-includes/canonical.php: redirect_guess_404_permalink() |
Attempts to guess the correct URL based on query vars |
wp-includes/rest-api.php: get_rest_url() |
Retrieves the URL to a REST endpoint on a site. |
wp-includes/post.php: wp_get_attachment_url() |
Retrieve the URL for an attachment. |
wp-includes/ms-functions.php: domain_exists() |
Checks whether a site name is already taken. |
wp-includes/ms-functions.php: insert_blog() |
Store basic site info in the blogs table. |
wp-includes/class-wp-editor.php: _WP_Editors::editor_settings() | |
wp-includes/comment-template.php: get_trackback_url() |
Retrieve The current post’s trackback URL. |
wp-includes/comment-template.php: get_comment_link() |
Retrieve the link to a given comment. |
wp-includes/functions.php: wp_privacy_exports_dir() |
Returns the directory used to store personal data export files. |
wp-includes/functions.php: wp_privacy_exports_url() |
Returns the URL of the directory used to store personal data export files. |
wp-includes/functions.php: wp_delete_file_from_directory() |
Deletes a file if its path is within the given directory. |
wp-includes/functions.php: get_temp_dir() |
Determine a writable directory for temporary files. |
wp-includes/functions.php: _wp_upload_dir() |
A non-filtered, non-cached version of wp_upload_dir() that doesn’t check the path. |
wp-admin/includes/class-wp-filesystem-ftpext.php: WP_Filesystem_FTPext::delete() | |
wp-admin/includes/class-wp-filesystem-ftpext.php: WP_Filesystem_FTPext::is_dir() | |
wp-admin/includes/class-wp-filesystem-ftpext.php: WP_Filesystem_FTPext::cwd() | |
wp-admin/includes/network.php: network_step2() |
Prints step 2 for Network installation process. |
wp-admin/includes/class-theme-upgrader.php: Theme_Upgrader::check_package() |
Check that the package source contains a valid theme. |
wp-admin/includes/class-theme-upgrader.php: Theme_Upgrader::delete_old_theme() |
Delete the old theme during an upgrade. |
wp-admin/includes/class-core-upgrader.php: Core_Upgrader::upgrade() |
Upgrade ClassicPress core. |
wp-admin/includes/class-wp-filesystem-direct.php: WP_Filesystem_Direct::chgrp() |
Changes file group |
wp-admin/includes/class-wp-filesystem-direct.php: WP_Filesystem_Direct::chmod() |
Changes filesystem permissions |
wp-admin/includes/class-wp-filesystem-direct.php: WP_Filesystem_Direct::delete() | |
wp-admin/includes/class-wp-filesystem-ftpsockets.php: WP_Filesystem_ftpsockets::cwd() | |
wp-admin/includes/class-wp-filesystem-base.php: WP_Filesystem_Base::find_folder() |
Locate a folder on the remote filesystem. |
wp-admin/includes/class-wp-filesystem-base.php: WP_Filesystem_Base::search_for_folder() |
Locate a folder on the remote filesystem. |
wp-admin/includes/class-wp-upgrader.php: WP_Upgrader::install_package() |
Install a package. |
wp-admin/includes/update-core.php: update_core() |
Upgrades the core of ClassicPress. |
wp-admin/includes/update-core.php: _upgrade_422_remove_genericons() |
Cleans up Genericons example files. |
wp-admin/includes/theme.php: delete_theme() |
Remove a theme |
wp-admin/includes/plugin.php: delete_plugins() |
Remove directory and files of a plugin for a list of plugins. |
wp-admin/includes/file.php: get_filesystem_method() |
Determines which method to use for reading, writing, modifying, or deleting files on the filesystem. |
wp-admin/includes/file.php: unzip_file() |
Unzips a specified ZIP file to a location on the Filesystem via the ClassicPress Filesystem Abstraction. |
wp-admin/includes/file.php: copy_dir() |
Copies a directory from one location to another via the ClassicPress Filesystem Abstraction. |
wp-admin/includes/file.php: get_home_path() |
Get the absolute filesystem path to the root of the ClassicPress installation |
wp-admin/includes/file.php: list_files() |
Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep. |
wp-admin/includes/class-wp-filesystem-ssh2.php: WP_Filesystem_SSH2::cwd() | |
wp-admin/includes/class-plugin-upgrader.php: Plugin_Upgrader::check_package() |
Check a source package to be sure it contains a plugin. |
wp-admin/includes/class-plugin-upgrader.php: Plugin_Upgrader::delete_old_plugin() |
Delete the old plugin during an upgrade. |
Changelog
Version | Description |
---|---|
WP-1.2.0 | Introduced. |