wp_basename( string $path, string $suffix = '' )
i18n friendly version of basename()
Description #Description
Parameters #Parameters
- $path
-
(string) (Required) A path.
- $suffix
-
(string) (Optional) If the filename ends in suffix this will also be cut off.
Default value: ''
Return #Return
(string)
Source #Source
File: wp-includes/formatting.php
function wp_basename( $path, $suffix = '' ) { return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) ); }
Expand full source code Collapse full source code View on Trac
Changelog #Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
Related #Related
Used By #Used By
Used By | Description |
---|---|
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php: WP_REST_Attachments_Controller::insert_attachment() |
Inserts the attachment post in the database. Does not update the attachment meta. |
wp-admin/includes/image.php: _wp_image_meta_replace_original() |
Updates the attached file and image meta data when the original image was edited. |
wp-admin/includes/file.php: verify_file_signature() |
Verifies the contents of a file against its ED25519 signature. |
wp-includes/post.php: wp_delete_attachment_files() |
Deletes all files that belong to the given attachment. |
wp-admin/includes/misc.php: wp_print_theme_file_tree() |
Outputs the formatted file list for the theme editor. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::import_theme_starter_content() |
Import theme starter content into the customized state. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::prepare_starter_content_attachments() |
Prepare starter content attachments. |
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php: WP_REST_Attachments_Controller::prepare_item_for_response() |
Prepares a single attachment output for response. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::get_return_url() |
Get URL to link the user to when closing the Customizer. |
wp-includes/media.php: wp_image_add_srcset_and_sizes() |
Adds ‘srcset’ and ‘sizes’ attributes to an existing ‘img’ element. |
wp-includes/media.php: wp_calculate_image_srcset() |
A helper function to calculate the image sources to include in a ‘srcset’ attribute. |
wp-admin/includes/class-wp-site-icon.php: WP_Site_Icon::create_attachment_object() |
Creates an attachment ‘object’. |
wp-admin/includes/ajax-actions.php: wp_ajax_crop_image() |
Ajax handler for cropping an image. |
wp-admin/includes/class-wp-media-list-table.php: WP_Media_List_Table::column_title() |
Handles the title column output. |
wp-includes/customize/class-wp-customize-media-control.php: WP_Customize_Media_Control::to_json() |
Refresh the parameters passed to the JavaScript via JSON. |
wp-admin/includes/image-edit.php: wp_image_editor() |
Loads the WP image-editing interface. |
wp-admin/includes/image.php: _copy_image_file() |
Copy an existing image file. |
wp-admin/includes/image.php: wp_generate_attachment_metadata() |
Generate attachment meta data and create image sub-sizes for images. |
wp-admin/includes/image.php: wp_crop_image() |
Crop an Image to a given size. |
wp-admin/includes/media.php: attachment_submitbox_metadata() |
Displays non-editable attachment metadata in the publish meta box. |
wp-admin/includes/media.php: get_media_item() |
Retrieve HTML form for modifying the image attachment. |
wp-admin/includes/media.php: wp_media_upload_handler() |
Handles the process of uploading media. |
wp-admin/includes/media.php: media_sideload_image() |
Downloads an image from the specified URL and attaches it to a post. |
wp-admin/includes/media.php: image_attachment_fields_to_save() |
Filters input from media_upload_form_handler() and assigns a default post_title from the file name if none supplied. |
wp-admin/includes/media.php: media_handle_upload() |
Save a file submitted from a POST request and create an attachment post for it. |
wp-admin/includes/media.php: media_handle_sideload() |
Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload(). |
wp-admin/includes/ajax-actions.php: wp_ajax_send_link_to_editor() |
Ajax handler for sending a link to the editor. |
wp-admin/includes/import.php: wp_import_handle_upload() |
Handle importer uploading and add attachment. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::create_attachment_object() |
Create an attachment ‘object’. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::step_2() |
Display second step of custom header image page. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::step_2_manage_upload() |
Upload the file to be cropped in the second step. |
wp-admin/includes/class-custom-image-header.php: Custom_Image_Header::step_3() |
Display third step of custom header image page. |
wp-admin/includes/class-custom-background.php: Custom_Background::handle_upload() |
Handle an Image upload for the background image. |
wp-includes/deprecated.php: get_theme_data() |
Retrieve theme data from parsed theme file. |
wp-includes/deprecated.php: get_attachment_icon_src() |
Retrieve icon URL and Path. |
wp-includes/class-wp-query.php: WP_Query::get_posts() |
Retrieves an array of posts based on query variables. |
wp-includes/class-wp-query.php: WP_Query::parse_tax_query() |
Parses various taxonomy related query vars. |
wp-includes/class-wp-image-editor-imagick.php: WP_Image_Editor_Imagick::_save() | |
wp-includes/functions.php: wp_upload_bits() |
Create a file in the upload folder with given content. |
wp-includes/functions.php: wp_upload_dir() |
Returns an array containing the current upload directory’s path and URL. |
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/class-wp-image-editor-gd.php: WP_Image_Editor_GD::_save() | |
wp-includes/media.php: wp_prepare_attachment_for_js() |
Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
wp-includes/media.php: get_attachment_taxonomies() |
Retrieves taxonomies attached to given the attachment. |
wp-includes/media.php: wp_get_attachment_image_src() |
Retrieve an image to represent an attachment. |
wp-includes/media.php: image_downsize() |
Scale an image to fit a particular size (such as ‘thumb’ or ‘medium’). |
wp-includes/post.php: wp_mime_type_icon() |
Retrieve the icon for a MIME type. |
wp-includes/post.php: wp_get_attachment_url() |
Retrieve the URL for an attachment. |
wp-includes/post.php: wp_get_attachment_thumb_file() |
Retrieve thumbnail for an attachment. |
wp-includes/post.php: wp_get_attachment_thumb_url() |
Retrieve URL for an attachment thumbnail. |