Ticket #5209: 5209.2.diff

File 5209.2.diff, 813 bytes (added by johnbillion, 5 years ago)

Add sanitize_option to add_option

  • wp-includes/functions.php

     
    337337        wp_protect_special_option( $name ); 
    338338        $safe_name = $wpdb->escape( $name ); 
    339339 
     340        $value = sanitize_option( $name, $value ); 
     341 
    340342        // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query 
    341343        $notoptions = wp_cache_get( 'notoptions', 'options' ); 
    342344        if ( !is_array( $notoptions ) || !isset( $notoptions[$name] ) ) 
     
    363365 
    364366        $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ) ); 
    365367 
     368        do_action( "add_option_$name", $value ); 
    366369        return; 
    367370} 
    368371