wordpress更改文件上传目录为”wp-content/uploads/年/月/日”

wordpress更改文件上传目录,需要在 wordpress\wp-includes 下,修改function.php函数

在配置文件结尾添加

/**wordpress年月日文件目录**/function custom_upload_directory( $uploads ) {date_default_timezone_set("Asia/Shanghai");//设置时区$subdir = date("Y/m/d");//设置目录格式$uploads['subdir'] = $subdir;$uploads['path'] = $uploads['basedir'].DIRECTORY_SEPARATOR.$subdir;$uploads['url'] = $uploads['baseurl'].'/'.$subdir;return $uploads;}add_filter( 'upload_dir', 'custom_upload_directory' );

下载仅供下载体验和测试学习,不得商用和正当使用。

下载体验

请输入密码查看下载!

如何免费获取密码?

点击下载

评论