Make WordPress Core

Ticket #37928: 37928.2.diff

File 37928.2.diff, 1.0 KB (added by flixos90, 9 years ago)
  • src/wp-includes/option.php

     
    412412
    413413        $value = sanitize_option( $option, $value );
    414414
     415        /**
     416         * Filters whether to short-circuit the process of adding an option.
     417         *
     418         * Returning a value other than null will short-circuit the process, and the value will be
     419         * returned cast as a bool.
     420         *
     421         * @since 4.7.0
     422         *
     423         * @param null   $skip   Whether to short-circuit the process. Default null.
     424         * @param string $option Name of the option to add.
     425         * @param mixed  $value  Option value.
     426         */
     427        $skip = apply_filters( 'pre_add_option', null, $option, $value );
     428        if ( ! is_null( $skip ) ) {
     429                return (bool) $skip;
     430        }
     431
    415432        // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
    416433        $notoptions = wp_cache_get( 'notoptions', 'options' );
    417434        if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )