customization - How to re-arrange media uploaded using : media_handle_upload() as per yearmonth

I have been facing this issue that all the new media files are getting uploaded to single folder which was auto-generate

I have been facing this issue that all the new media files are getting uploaded to single folder which was auto-generated during initial site development. Now since all new images are getting uploaded to single folder its very difficult to maintain.

Settings to organize media are enabled but that works only if media is uploaded from WP backend and i have written custom code for media upload as shown below:

require_once( ABSPATH . 'wp-admin/includes/image.php' );
require_once( ABSPATH . 'wp-admin/includes/file.php' );
require_once( ABSPATH . 'wp-admin/includes/media.php' );

$attachment_id = media_handle_upload( 'img', $_POST["add-to-cart"]);

So basically there is woocommerce cart where i have added custom media field from which user can upload media and storing the same using above code.

Any help much appreciated, Thanks

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744925360a4601400.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信