• Resolved megaadmin

    (@megaadmin)


    Hello. There is a question about data cleaning. Is it necessary to clean the data before output even if the data is never changed by the user. Example: I doing customization in the customizer “turn on sidebar”. Saving data of this setting is cleared (sanitize callback). In the template file I use this:

    
    $settings_name = get_theme_mod( 'settings_name', 1 ); // 1 default
    $class = ( $settings_name ) ? 'col-md-8' : 'col-md-12';
    

    And put here:

    
    <div class="<?php echo $class; ?>">
    

    Or

    
    <div class="<?php echo esc_attr( $class ); ?>">
    

    Do need to clear this value? After all, the user does not interact with it. That is, The first or second option?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Data cleansing in WordPress.’ is closed to new replies.