trailingslashit( string $value )
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
- $value
-
(Required) Value to which trailing slash will be added.
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-admin/includes/class-wp-site-health.php: WP_Site_Health::wp_cron_scheduled_check() |
Runs the scheduled event to check and update the latest site health status for the website. |
wp-admin/includes/file.php: wp_opcache_invalidate_directory() |
Attempts to clear the opcode cache for a directory of files. |
wp-admin/includes/file.php: move_dir() |
Initializes and connects the ClassicPress Filesystem Abstraction classes. |
wp-includes/l10n.php: load_script_textdomain() |
Loads the script translated strings. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::match_request_to_handler() |
Matches a request object to its handler. |
wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php: WP_REST_Menu_Locations_Controller::prepare_links() |
Prepares links for the request. |
wp-includes/ms-site.php: wp_normalize_site_data() |
Normalizes data for a site prior to inserting or updating in the database. |
wp-includes/general-template.php: paginate_links() |
Retrieves paginated links for archive post pages. |
wp-includes/l10n.php: _load_textdomain_just_in_time() |
Loads plugin and theme text domains just-in-time. |
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() |
Sends 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() |
Initializes the admin bar. |
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/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() |
Examines 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 for a 404 request 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() |
Retrieves the URL for an attachment. |
wp-includes/ms-functions.php: domain_exists() |
Checks whether a site name is already taken. |
wp-includes/class-wp-editor.php: _WP_Editors::editor_settings() | |
wp-includes/comment-template.php: get_trackback_url() |
Retrieves the current post’s trackback URL. |
wp-includes/comment-template.php: get_comment_link() |
Retrieves 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() |
Determines 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-includes/functions.php: wp_unique_filename() |
Gets a filename that is sanitized and unique for the given directory. |
wp-admin/includes/class-wp-filesystem-ftpext.php: WP_Filesystem_FTPext::delete() |
Deletes a file or directory. |
wp-admin/includes/class-wp-filesystem-ftpext.php: WP_Filesystem_FTPext::is_dir() |
Checks if resource is a directory. |
wp-admin/includes/class-wp-filesystem-ftpext.php: WP_Filesystem_FTPext::dirlist() |
Gets details for files in a directory or a specific file. |
wp-admin/includes/class-wp-filesystem-ftpext.php: WP_Filesystem_FTPext::cwd() |
Gets the current working directory. |
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() |
Checks 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-wp-filesystem-ftpsockets.php: WP_Filesystem_ftpsockets::dirlist() |
Gets details for files in a directory or a specific file. |
wp-admin/includes/class-wp-filesystem-ftpsockets.php: WP_Filesystem_ftpsockets::cwd() |
Gets the current working directory. |
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 the 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() |
Deletes a file or directory. |
wp-admin/includes/class-wp-filesystem-direct.php: WP_Filesystem_Direct::dirlist() |
Gets details for files in a directory or a specific file. |
wp-admin/includes/class-wp-filesystem-base.php: WP_Filesystem_Base::find_folder() |
Locates a folder on the remote filesystem. |
wp-admin/includes/class-wp-filesystem-base.php: WP_Filesystem_Base::search_for_folder() |
Locates 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() |
Removes a theme. |
wp-admin/includes/plugin.php: delete_plugins() |
Removes 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 WordPress Filesystem Abstraction. |
wp-admin/includes/file.php: copy_dir() |
Copies a directory from one location to another via the WordPress Filesystem Abstraction. |
wp-admin/includes/file.php: get_home_path() |
Gets 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() |
Gets the current working directory. |
wp-admin/includes/class-wp-filesystem-ssh2.php: WP_Filesystem_SSH2::dirlist() |
Gets details for files in a directory or a specific file. |
wp-admin/includes/class-plugin-upgrader.php: Plugin_Upgrader::check_package() |
Checks that the source package contains a valid plugin. |
wp-admin/includes/class-plugin-upgrader.php: Plugin_Upgrader::delete_old_plugin() |
Deletes the old plugin during an upgrade. |
Changelog
Version | Description |
---|---|
1.2.0 | Introduced. |