Hi Stiofan,
I’ve tried the following, but I can’t get it to work. It’s starting to frustrate me. Could you help me out with the right code, please?
I want all geodirectory entries to be saved under uploads/places/[year]/[month]/.
add_filter('upload_dir', array(&$this, 'aa_geodir_ext_custom_gd_place_upload_dir'));
function aa_geodir_ext_custom_gd_place_upload_dir( $args ) {
$id = $_REQUEST['post_id'];
$parent = get_post( $id )->post_parent;
// Check the post-type of the current post
if( "gd_place" == get_post_type( $id ) || "gd_place" == get_post_type( $parent ) ) {
$args['subdir'] = "/places" . '/' . date( 'Y/m' ) . $args['subdir'];
$args['path'] = $args['basedir'] . $args['subdir'];
$args['url'] = $args['baseurl'] . $args['subdir'];
// $args['baseurl'] = $args['baseurl'] . "/places" . '/' . date( 'Y/m' );
}
return $args;
}