• Resolved teeboy4real

    (@teeboy4real)


    Hi

    Will your plugin work smoothly after changing upload path using code below

    /* Change wordpress media upload directory to (media) folder */
    function custom_upload_directory( $upload ) {
    // Set the custom directory name
    $custom_directory = '/media';

    // Always include year and month-based subfolders
    $time = current_time( 'mysql' );
    $y = substr( $time, 0, 4 );
    $m = substr( $time, 5, 2 );

    // Update path and URL to the custom directory with year and month
    $upload['subdir'] = "$custom_directory/$y/$m";
    $upload['path'] = $upload['basedir'] . $upload['subdir'];
    $upload['url'] = $upload['baseurl'] . $upload['subdir'];

    return $upload;
    }
    add_filter( 'upload_dir', 'custom_upload_directory' );

    Note that the media settings option (Organize my uploads into month- and year-based folders) is disabled to avoid conflict with code above

Viewing 1 replies (of 1 total)
  • Plugin Author Masoud Golchin

    (@masoudin)

    Hi @teeboy4real
    Since Advanced Media Offloader uses WordPress hooks to implement its features, codes like yours that are using WordPress hooks, won’t break the functionality.

    Have you tested this code with our plugin? Let us know if you faced any issues and we will help you resolving that issue.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.