It looks like this attribute is hardcoded into your body tag.
You could adjust it with your own body_lang()
function like this (untested) :
<body
<?php ( function_exists( 'body_lang' ) ) ? body_lang() : '' ;?>
<?php body_class(); ?>
>
where you can define the following, in your functions.php
file:
/**
* Display the language attribute part for the body element.
*
* @param string $lang.
* @return void.
*/
if( ! function_exists( 'body_lang' ) )
{
function body_lang( $lang = '' )
{
if( function_exists( 'get_body_lang' ) )
echo get_body_lang( $lang );
}
} // end if function exists
and
/**
* Retrieve the language part for the body element.
*
* @param string $lang.
* @return string $lang.
*/
if( ! function_exists( 'get_body_lang' ) )
{
function get_body_lang( $lang = '' )
{
// default language
$lang = ( ! empty( $lang ) ) ? $lang : 'ur';
// add your own logic here:
if( is_single() )
$lang = 'de';
elseif( is_page() )
$lang = 'en';
$attr = sprintf( 'lang="%s"', $lang );
return apply_filters( 'body_lang', $attr );
}
} // end if function exists
where the filter body_lang
gives you further control.
To remove it, according to your own special logic, you can for example use:
/**
* Remove the language part according to a custom logic
*
* @param string $attr.
* @return string $attr.
*/
function my_body_lang( $attr )
{
// add your own logic here:
if( is_single() )
{
// get the post meta value for 'language'.
// It can be 'Yes', 'No' or empty
$show = get_post_meta( get_the_ID(), 'language', TRUE );
// Let's hide it if it's empty or 'No'
if( empty( $show ) || "No" === $show )
$attr="";
}
return $attr;
}
add_filter( 'body_lang', 'my_body_lang' );
Hopefully this points you towards a solution.