[Shipper Pro] Exclude directories in Shipper

If this is already possible I'm not finding it, but I'd like the ability to exclude things when moving a site with Shipper. For example, when pushing my dev version from localhost to staging, it moved my entire .git repository in my theme file, which is completely unnecessary and took forever. I also use some plugins that I only use in development, and several plugins (such as security plugins) that I only use for staging and production.

This is probably a separate feature request but it would also be cool if Shipper could tell which files have been changed and only move those ones, so that future migrations don't take so long.

  • Vladislav
    • Dead Eye Dev


    Unfortunately, the plugin currently doesn’t have a way to exclude arbitrary files within the UI (well, except for the files reported by the preflight check). However, it is possible to do so with some custom code, by making use of the filter named “shipper_path_include_file” exposed by the plugin. This is a boolean (true/false) filter, and sends the file path as an additional parameter. A quick usage example would probably be more meaningful here, and it might look a bit like this:

    add_filter( 'shipper_path_include_file', 'my_shipper_skip_plugins', 10, 2 );
    function my_shipper_skip_plugins( $include, $path ) {
    if ( empty( $include ) ) { return $include; }

    if (preg_match('/' . preg_quote('.git', '/') . '/', $path)) return false;
    if (preg_match('/' . preg_quote('wp-content/plugins/my-plugin-to-exclude', '/') . '/', $path)) return false;

    return $include;

    Obviously, there are plenty of ways to improve upon this example, but I hope it illustrates how the filter might be used.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.