• Resolved yoche2001

    (@yoche2001)


    For the last couple of months I used the ai1wm_exclude_content_from_export-Filter to exclude my theme’s node_modules from being backuped as following:

    add_filter( 'ai1wm_exclude_content_from_export',
                function ( $exclude_filters ) {
                    $nodeFolder        = preg_replace( "/(.*?)themes/", "themes",
                            $this->themeFolder ) . '/node_modules';
                    $exclude_filters[] = $nodeFolder;
    
                    return $exclude_filters;
                } );

    But for some reason this not working any more so I have to use the exclude-option in the webinterface, which is a bit tedious.

    I’ve already checked the $this->themeFolder, it seems to be correct.

    Has anyone a hint what the problem may be?

    • This topic was modified 3 years, 2 months ago by yoche2001.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Yani

    (@yaniiliev)

    We’ve divided the different parts of export into different filters.
    You will need to use ai1wm_exclude_themes_from_export filter instead.

    I tried using

    add_filter( 'ai1wm_exclude_themes_from_export',
    function ( $exclude_filters ) {
      $exclude_filters[] = '/themes/theme-name/node_modules';
      return $exclude_filters;
    } );

    The relative path is correct.
    But somehow it still does not seem to exclude. Any advice on what I am doing wrong here?

    • This reply was modified 3 years, 2 months ago by OR.
    Plugin Author Yani

    (@yaniiliev)

    Try with:

    
    add_filter( 'ai1wm_exclude_themes_from_export',
    function ( $exclude_filters ) {
      $exclude_filters[] = 'theme-name/node_modules';
      return $exclude_filters;
    } );
    

    Two changes:
    1. When you are using ai1wm_exclude_themes_from_export the path is already wp-content/themes/
    2. Do not add forward slash /, if you do, the plugin will think that it is absolute path and will not append wp-content/themes to it.

    Thanks for this! working as expected.

    Thread Starter yoche2001

    (@yoche2001)

    Cheers, Yani, now it’s working again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Excluding node_modules via filter not working anymore’ is closed to new replies.