wp_basename( string $path, string $suffix = '' ): string
i18n-friendly version of basename().
Parameters
-
$path
string Required -
A path.
-
$suffix
string Optional -
If the filename ends in suffix this will also be cut off.
Default:
''
Return
string
Source
File: wp-includes/formatting.php
.
View all references
function wp_basename( $path, $suffix = '' ) {
return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
}
Related
Used By
Used By | Description |
---|---|
WP_REST_Attachments_Controller::edit_media_item() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php |
Applies edits to a media item and creates a new attachment record. |
wp_image_src_get_dimensions() wp-includes/media.php |
Determines an image’s width and height dimensions based on the source file. |
WP_REST_Attachments_Controller::insert_attachment() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php |
Inserts the attachment post in the database. Does not update the attachment meta. |
_wp_image_meta_replace_original() wp-admin/includes/image.php |
Updates the attached file and image meta data when the original image was edited. |
verify_file_signature() wp-admin/includes/file.php |
Verifies the contents of a file against its ED25519 signature. |
wp_delete_attachment_files() wp-includes/post.php |
Deletes all files that belong to the given attachment. |
wp_print_theme_file_tree() wp-admin/includes/misc.php |
Outputs the formatted file list for the theme file editor. |
WP_Customize_Manager::import_theme_starter_content() wp-includes/class-wp-customize-manager.php |
Imports theme starter content into the customized state. |
WP_Customize_Manager::prepare_starter_content_attachments() wp-includes/class-wp-customize-manager.php |
Prepares starter content attachments. |
WP_REST_Attachments_Controller::prepare_item_for_response() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php |
Prepares a single attachment output for response. |
WP_Customize_Manager::get_return_url() wp-includes/class-wp-customize-manager.php |
Gets URL to link the user to when closing the Customizer. |
wp_image_add_srcset_and_sizes() wp-includes/media.php |
Adds ‘srcset’ and ‘sizes’ attributes to an existing ‘img’ element. |
wp_calculate_image_srcset() wp-includes/media.php |
A helper function to calculate the image sources to include in a ‘srcset’ attribute. |
WP_Site_Icon::create_attachment_object() wp-admin/includes/class-wp-site-icon.php |
Creates an attachment ‘object’. |
wp_ajax_crop_image() wp-admin/includes/ajax-actions.php |
Handles cropping an image via AJAX. |
WP_Media_List_Table::column_title() wp-admin/includes/class-wp-media-list-table.php |
Handles the title column output. |
WP_Customize_Media_Control::to_json() wp-includes/customize/class-wp-customize-media-control.php |
Refresh the parameters passed to the JavaScript via JSON. |
wp_image_editor() wp-admin/includes/image-edit.php |
Loads the WP image-editing interface. |
_copy_image_file() wp-admin/includes/image.php |
Copies an existing image file. |
wp_generate_attachment_metadata() wp-admin/includes/image.php |
Generates attachment meta data and create image sub-sizes for images. |
wp_crop_image() wp-admin/includes/image.php |
Crops an image to a given size. |
attachment_submitbox_metadata() wp-admin/includes/media.php |
Displays non-editable attachment metadata in the publish meta box. |
get_media_item() wp-admin/includes/media.php |
Retrieves HTML form for modifying the image attachment. |
wp_media_upload_handler() wp-admin/includes/media.php |
Handles the process of uploading media. |
media_sideload_image() wp-admin/includes/media.php |
Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post. |
media_handle_upload() wp-admin/includes/media.php |
Saves a file submitted from a POST request and create an attachment post for it. |
media_handle_sideload() wp-admin/includes/media.php |
Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload() . |
wp_ajax_send_link_to_editor() wp-admin/includes/ajax-actions.php |
Handles sending a link to the editor via AJAX. |
wp_import_handle_upload() wp-admin/includes/import.php |
Handles importer uploading and adds attachment. |
Custom_Image_Header::create_attachment_object() wp-admin/includes/class-custom-image-header.php |
Creates an attachment ‘object’. |
Custom_Image_Header::step_2() wp-admin/includes/class-custom-image-header.php |
Displays second step of custom header image page. |
Custom_Image_Header::step_2_manage_upload() wp-admin/includes/class-custom-image-header.php |
Uploads the file to be cropped in the second step. |
Custom_Image_Header::step_3() wp-admin/includes/class-custom-image-header.php |
Displays third step of custom header image page. |
Custom_Background::handle_upload() wp-admin/includes/class-custom-background.php |
Handles an Image upload for the background image. |
get_theme_data() wp-includes/deprecated.php |
Retrieve theme data from parsed theme file. |
get_attachment_icon_src() wp-includes/deprecated.php |
Retrieve icon URL and Path. |
WP_Query::get_posts() wp-includes/class-wp-query.php |
Retrieves an array of posts based on query variables. |
WP_Query::parse_tax_query() wp-includes/class-wp-query.php |
Parses various taxonomy related query vars. |
WP_Image_Editor_Imagick::_save() wp-includes/class-wp-image-editor-imagick.php | |
wp_upload_bits() wp-includes/functions.php |
Creates a file in the upload folder with given content. |
wp_upload_dir() wp-includes/functions.php |
Returns an array containing the current upload directory’s path and URL. |
WP_Image_Editor::get_output_format() wp-includes/class-wp-image-editor.php |
Returns preferred mime-type and extension based on provided file’s extension and mime, or current file’s extension and mime. |
WP_Image_Editor::generate_filename() wp-includes/class-wp-image-editor.php |
Builds an output filename based on current file, and adding proper suffix |
WP_Image_Editor_GD::_save() wp-includes/class-wp-image-editor-gd.php | |
wp_prepare_attachment_for_js() wp-includes/media.php |
Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
get_attachment_taxonomies() wp-includes/media.php |
Retrieves taxonomies attached to given the attachment. |
wp_get_attachment_image_src() wp-includes/media.php |
Retrieves an image to represent an attachment. |
image_downsize() wp-includes/media.php |
Scales an image to fit a particular size (such as ‘thumb’ or ‘medium’). |
wp_mime_type_icon() wp-includes/post.php |
Retrieves the icon for a MIME type or attachment. |
wp_get_attachment_url() wp-includes/post.php |
Retrieves the URL for an attachment. |
wp_get_attachment_thumb_file() wp-includes/deprecated.php |
Retrieves thumbnail for an attachment. |
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Result: module-1-your-introduction-to-floristry