function get_year_month_directory_name($time = null)
{
if (!$time && isset($_POST['post_id'])) {
$time = get_post_field('post_date', $_POST['post_id']);
}
if (!$time) {
$time = current_time('mysql');
}
$y = substr($time, 0, 4);
$m = substr($time, 5, 2);
$subdir = "/{$y}/{$m}";
if (false === strpos($subdir, '//')) {
return $subdir;
}
return '';
}