Got a warning in envato theme checker that it should be escaped.
This is the error
Found echo $ in the file abc.php. Possible data validation issues found. All dynamic data must be correctly escaped for the context where it is rendered.
this is the error code
echo $this->parent->section_menu ( $k, $section );
I understand that it should be escaped, but I don't know how to apply escape to this kind of code. I successfully applied echo esc_html($variable);
but doing same to above line seems troublesome.
I tried,
<?php echo esc_attr( $this->parent->section_menu ( $k, $section )); ?>
<?php echo __($this->parent->section_menu ( $k, $section ) );?>
<?php echo $this->parent->section_menu ( esc_attr( $k) , esc_attr($section) ); ?>
but it's not working and messing up the view. can someone help me?