pro && aioseo()->options->sitemap->video->advancedSettings->enable && in_array( 'staticVideoSitemap', aioseo()->internalOptions->internal->deprecatedOptions, true ) && ! aioseo()->options->deprecated->sitemap->video->advancedSettings->dynamic; $detectedFiles = []; if ( ! $isVideoSitemapStatic ) { foreach ( $files as $filename ) { if ( preg_match( '#.*sitemap.*#', (string) $filename ) ) { $isVideoSitemap = preg_match( '#.*video.*#', (string) $filename ) ? true : false; if ( $isVideoSitemap ) { $detectedFiles[] = $filename; } } } } if ( ! count( $detectedFiles ) ) { return $response; } $fs = aioseo()->core->fs; if ( ! $fs->isWpfsValid() ) { return $response; } foreach ( $detectedFiles as $file ) { $fs->fs->delete( $file, false, 'f' ); } Models\Notification::deleteNotificationByName( 'sitemap-static-files' ); return new \WP_REST_Response( [ 'success' => true, 'notifications' => Models\Notification::getNotifications() ], 200 ); } }