Hi Manni,
There are up to six different mechanisms you can use to exclude things, documented in an FAQ here:
https://updraftplus.com/faqs/how-can-i-exclude-particular-filesdirectories-from-the-backup/
David
Hello David,
I know that already. But for example your normal excludes are only working for “uploads” and not for the “theme” directory. So I don’t need 6 solutions which are not able to filter a sub-directory out of the theme folder. On your link, solution 1 is only for uploads. Solution 2 is bad for theme directory perhaps they can have files changed on updates. Solution 3 only for extension…
So, instead of showing your good, simply a good example for filtering a sub-folder as example “/themename/sub1/sub2”, would be very kind of you.
Thanks a lot
Manni
Plugin Contributor
bcrodua
(@bcrodua)
Hi Manni,
Will #2 from our guide help you achieve what you want? I copied it below.
2. Create a file called .donotbackup in a directory
If you create a file called “.donotbackup” (without the quotes) in any directory, then that directory (and its sub-directories) will be excluded from the backup.
Regards,
Bryle
As I wrote “Solution #2 is bad for theme directory, perhaps they can have files changed on updates” … or by reinstall the theme.
Also I don’t like solution #2 because I think it’s not a good idea to control behavior of plugins by creating files specific folders. It’s not good for overview and maintainability. How do you get a fast overview about excluded sub-folders, only by searching all theme folders for “.donotbackup” files? I think it’s not a good idea.
Normally these kinds of plugin behavior should be controlled in the plugin itself. (But the plugin UI only supports “uploads” folder and not “theme”.)
Under the official link is a solution #5 with placing some lines of code in the functions.php to exclude something.
Perhaps you could give an example for filtering a “theme”-sub-folder as example “/themename/sub1/sub2” on this functions.php solution?
And with a small advice, if I have to put it in the top/bottom of the functions.php of the child theme or if I can put it anywhere in that file.
Thanks a lot
Manni
-
This reply was modified 6 years, 7 months ago by
Manni79.
Hi Manni,
For a filter that excludes a subfolder of a theme:
add_filter('updraftplus_exclude_directory', 'my_updraftplus_exclude_directory', 10, 3);
function my_updraftplus_exclude_directory($filter, $full_dir, $path) {
return ($path == 'themes/<THEME NAME>/<sub_folder>') ? true : $filter;
}
This can be placed anywhere in the functions.php file.
thank you! Solved.
Would be nice to see this example in your official exclude-examples, because this filter is missing there.