# wplingua/2.12.3/inc/dom/replace-attr-dir.php

Translate and Go multilingual – Automatic AI translation – wpLingua, version 2.12.3. 26 lines.

- Page: https://pluginprobe.com/plugins/wplingua/2.12.3/code/inc/dom/replace-attr-dir.php
- Raw: https://pluginprobe.com/plugins/wplingua/2.12.3/raw/inc/dom/replace-attr-dir.php
- Modified: 2026-05-07T00:05:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wplingua/2.12.3/code/inc/dom/replace-attr-dir.php#L10-L20`.

```php
<?php

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}


/**
 * Modify the dir attribute in dom for translated pages
 *
 * @param object $dom
 * @param array  $args
 * @return object
 */
function wplng_dom_replace_attr_dir( $dom, $args ) {

	wplng_args_setup( $args );

	foreach ( $dom->find( 'body' ) as $element ) {
		$element->{'dir'} = esc_attr( $args['language_target_dir'] );
	}

	return $dom;
}

```
