V
V
Vladimir Glebov2017-01-21 22:06:40
WordPress
Vladimir Glebov, 2017-01-21 22:06:40

Where to paste code to change upload folder in Wordpress?

Friends, tell me in which file to insert the code to change the file download directories?
The problem is, 90,000 are loaded into one folder (the month of January), which is too much. I want to break it down by date. Uploading files via Wp All Import.
Received advice from the developers. But I'm not a programmer. How to use it?
"If you mean that you want to import images to a different folder, you would need to write some custom PHP code tied to the upload_dir WordPress hook. Here's a basic example where we added a date to the folder:
add_filter('upload_dir', 'add_date_to_upload_dir');
function add_date_to_upload_dir( $param ) {
$date = date('d');
$dir = '/' . $date;
$param['path'] = $param[' path']. $dir;
$param['url'] = $param['url'] . $dir;
return $param;
}
"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mr Crabbz, 2017-01-21
@ChiefEditor

to the end of functions.php file in /wp-content/themes/your_theme/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question