Skip to content

Instantly share code, notes, and snippets.

@thefrosty
Created August 26, 2014 02:45
Show Gist options
  • Save thefrosty/6645a2b4085be81c12d3 to your computer and use it in GitHub Desktop.
Save thefrosty/6645a2b4085be81c12d3 to your computer and use it in GitHub Desktop.
Check post type before modifying upload directory in EDD FES (v2.2.9.5).
$override_default_dir = apply_filters('override_default_fes_dir', false );
if ( function_exists( 'edd_set_upload_dir' ) && !$override_default_dir ) {
add_filter( 'upload_dir', 'edd_set_upload_dir' );
}
else if ( $override_default_dir ){
add_filter( 'upload_dir', 'fes_set_custom_upload_dir' );
}
if ( ! empty( $_REQUEST['post_id'] ) && 'download' == get_post_type( $_REQUEST['post_id'] ) ) {
$override_default_dir = apply_filters('override_default_fes_dir', false );
if ( function_exists( 'edd_set_upload_dir' ) && !$override_default_dir ) {
add_filter( 'upload_dir', 'edd_set_upload_dir' );
}
else if ( $override_default_dir ){
add_filter( 'upload_dir', 'fes_set_custom_upload_dir' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment