Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 119448

scottdky on "[Plugin: Custom Upload Dir] multiple taxonomies are duplicated in the path"

$
0
0

When an image's post belongs to multiple sub-categories (or other taxonomies), the top category is duplicated in the resulting path. Example:

Dir Path: /%category%/%type%

Post belongs to:

Tech & Blue and Tech & Red

Resulting path is:

/tech-tech/blue-red

A better result is:

/tech/blue-red

Code fix (in function cud_build_term_path; line 208):

Old: $path .= implode('-', wp_list_pluck($terms, 'slug')) . '/';

New: $path .= implode('-', array_unique(wp_list_pluck($terms, 'slug'))) . '/';

http://wordpress.org/extend/plugins/custom-upload-dir/


Viewing all articles
Browse latest Browse all 119448

Trending Articles