WordPress.org

Ready to get started?Download WordPress

Forums

Custom Upload Dir
multiple taxonomies are duplicated in the path (3 posts)

  1. scottdky
    Member
    Posted 1 year ago #

    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/

  2. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for taking the time! I'll get back to you when the new version is out.

  3. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.