1

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?

Van Dyke
  • 23
  • 5
  • What does “messing up the view” mean, exactly? And what does this method return in the first place? If it does return properly encoded output already, then encoding it a second time would obviously be wrong. – misorude Feb 12 '20 at 10:59
  • I think it shouldnt be escaped since if I used above escape methods, then it shows mixed characters and text. it's just envato theme check plugun shows some errors/warnings when we use echo $vaiable anywhere – Van Dyke Feb 12 '20 at 11:12

0 Answers0