how can I write a custom string in functions.php?

Top WooCommerce & WordPress Plugins Forums File Renaming on Upload – WordPress Plugin how can I write a custom string in functions.php?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #100054
    digitalform
    Participant

    Hi,

    how can I write a custom string in functions.php?

    Best regards,
    Peter

    #100055
    Pablo Pacheco
    Participant

    Hi,

    First, you have to create a custom rule in the filename structure option using curly braces, like {my_custom_rule}. You just have to write it, in any position you want.

    Then you can use the filter frou_sanitize_file_name to create a custom function. For example, if you want to add the user id it would be something like this:

    add_filter( 'frou_sanitize_file_name', function($filename_infs){
        $filename_infs['structure']['translation']['my_custom_rule'] = get_current_user_id();
        return $filename_infs;
    }, 20 );
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.