Skip to main content
added 68 characters in body
Source Link
krembo99
  • 2.5k
  • 1
  • 16
  • 13

The sequencing part will be handled automatically by wordpress.

if you want to change the filename, you can do this :

function k99_custom_upload_name($filename)
{
  $info = pathinfo($filename);
  $ext  = empty($info['extension']) ? '' : '.' . $info['extension'];
  $filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

Because wordpress will handle the sequencing , your files will be named :

  • put your name here.ext
  • put your name here1.ext
  • put your name here2.ext

etc.. etc..

an alternative (shorter) way , that would not require to handle the extension would be :

function k99_custom_upload_name($filename)
{
$post_for_id = $post->post_parent;
    $filename= 'put your name here -'.$filename;
    return $filename;
}

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

In this case your files will be renamed like so :

  • put your name here-originalname.ext
  • put your name here1here-originalname1.ext
  • put your name here2here-originalname2.ext

etc.. etc..

The sequencing part will be handled automatically by wordpress.

if you want to change the filename, you can do this :

function k99_custom_upload_name($filename)
{
  $info = pathinfo($filename);
  $ext  = empty($info['extension']) ? '' : '.' . $info['extension'];
  $filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

Because wordpress will handle the sequencing , your files will be named :

  • put your name here
  • put your name here.ext
  • put your name here1.ext
  • put your name here2.ext

etc.. etc..

The sequencing part will be handled automatically by wordpress.

if you want to change the filename, you can do this :

function k99_custom_upload_name($filename)
{
  $info = pathinfo($filename);
  $ext  = empty($info['extension']) ? '' : '.' . $info['extension'];
  $filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

Because wordpress will handle the sequencing , your files will be named :

  • put your name here.ext
  • put your name here1.ext
  • put your name here2.ext

etc.. etc..

an alternative (shorter) way , that would not require to handle the extension would be :

function k99_custom_upload_name($filename)
{
$post_for_id = $post->post_parent;
    $filename= 'put your name here -'.$filename;
    return $filename;
}

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

In this case your files will be renamed like so :

  • put your name here-originalname.ext
  • put your name here-originalname1.ext
  • put your name here-originalname2.ext

etc.. etc..

added 68 characters in body
Source Link
krembo99
  • 2.5k
  • 1
  • 16
  • 13

The sequencing part will be handled automatically by wordpress.

if you want to change the filename, you can do this :

function k99_custom_upload_name($filename)
{
  $info = pathinfo($filename);
  $ext  = empty($info['extension']) ? '' : '.' . $info['extension'];
  $filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

Because wordpress will handle the sequencing , your files will be named :

  • put your name here
  • put your name here.ext
  • put your name here1.ext
  • put your name here2.ext

etc.. etc..

The sequencing part will be handled automatically by wordpress.

if you want to change the filename, you can do this :

function k99_custom_upload_name($filename)
{
$filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

The sequencing part will be handled automatically by wordpress.

if you want to change the filename, you can do this :

function k99_custom_upload_name($filename)
{
  $info = pathinfo($filename);
  $ext  = empty($info['extension']) ? '' : '.' . $info['extension'];
  $filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

Because wordpress will handle the sequencing , your files will be named :

  • put your name here
  • put your name here.ext
  • put your name here1.ext
  • put your name here2.ext

etc.. etc..

added 68 characters in body
Source Link
krembo99
  • 2.5k
  • 1
  • 16
  • 13

The sequencing part will be handled automatically by wordpress.

if you want to change the filename, you can do this :

function k99_custom_upload_name($filename)
{
$filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

the sequence will be handled automatically by wordpress.

function k99_custom_upload_name($filename)
{
$filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);

the sequence will be handled automatically by wordpress.

The sequencing part will be handled automatically by wordpress.

if you want to change the filename, you can do this :

function k99_custom_upload_name($filename)
{
$filename  =  'put your name here';
     return $filename;
 }

add_filter('sanitize_file_name', 'k99_custom_upload_name', 10);
Source Link
krembo99
  • 2.5k
  • 1
  • 16
  • 13
Loading