public function register_path( $dir = null, $persistent = true ) {
		$result = false;

		// Cast parameters to known values.
		$dir = (string) $dir;
		$persistent = (bool) $persistent;

		if ( empty( $dir ) ) {
			$dir = $this->get_default_path();
		}

		$path_fail_reason = $this->validate_path( $dir );
		if ( $path_fail_reason ) {
			return new WP_Error( 'custom_theme_path_invalid', "Custom themes directory is invalid: $path_fail_reason", $dir );
		}

		// Register custom-theme path for "on the fly".
		$result = register_theme_directory( $dir );

		if ( ! $persistent ) {
			return $result;
		}

		// WordPress option is already set.
		if ( get_option( 'stylesheet_root' ) === $dir ) {
			return $result;
		}

		// Update WordPress option if persistence is required.
		//
		// Not returning the result of this operation as it can
		// be confusing - false is returned either on failure or
		// when the option value was the same and wasn't updated.
		update_option( 'stylesheet_root', $dir );
	}