_wp_relative_upload_path
函数
_wp_relative_upload_path ( $path )
- Access
- Private
- 参数
-
-
(string)
$path
Full path to the file.- Required: 是
-
(string)
- 返回值
-
- (string) Relative path on success, unchanged path on failure.
- 定义位置
-
-
wp-includes/post.php
, line 796
-
wp-includes/post.php
- 引入
- 2.9.0
- 弃用
- –
返回上传文件的相对路径。
该路径是相对于当前上传目录的。
function _wp_relative_upload_path( $path ) { $new_path = $path; $uploads = wp_get_upload_dir(); if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) { $new_path = str_replace( $uploads['basedir'], '', $new_path ); $new_path = ltrim( $new_path, '/' ); } /** * Filters the relative path to an uploaded file. * * @since 2.9.0 * * @param string $new_path Relative path to the file. * @param string $path Full path to the file. */ return apply_filters( '_wp_relative_upload_path', $new_path, $path ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。