wp/lib/blobfolio/wp/bm/svg/svg_dom.php
protected static function remove_namespace($dom, $namespace) {
		if (
			!is_a($dom, 'DOMDocument') ||
			!is_string($namespace) ||
			!strlen($namespace)
		) {
			return false;
		}

		try {
			$xpath = new DOMXPath($dom);
			$nodes = $xpath->query("//*[namespace::{$namespace} and not(../namespace::{$namespace})]");
			for ($x = 0; $x < $nodes->length; $x++) {
				$node = $nodes->item($x);
				$node->removeAttributeNS($node->lookupNamespaceURI($namespace), $namespace);
			}

			return true;
		} catch (\Throwable $e) {
			error_log($e->getMessage());
			return false;
		} catch (\Exception $e) {
			return false;
		}

		return false;
	}
protected static function remove_namespace($dom, $namespace) {
		if (
			!is_a($dom, 'DOMDocument') ||
			!is_string($namespace) ||
			!strlen($namespace)
		) {
			return false;
		}

		try {
			$xpath = new DOMXPath($dom);
			$nodes = $xpath->query("//*[namespace::{$namespace} and not(../namespace::{$namespace})]");
			for ($x = 0; $x < $nodes->length; $x++) {
				$node = $nodes->item($x);
				$node->removeAttributeNS($node->lookupNamespaceURI($namespace), $namespace);
			}

			return true;
		} catch (\Throwable $e) {
			error_log($e->getMessage());
			return false;
		} catch (\Exception $e) {
			return false;
		}

		return false;
	}
Remove namespace (and attached nodes) from a DOMDocument

@param DOMDocument $dom Object.
@param string      $namespace Namespace.
@return bool True/False.