Make WordPress Core

Changeset 12164


Ignore:
Timestamp:
11/11/2009 03:26:11 PM (15 years ago)
Author:
ryan
Message:

Add actions for option writes. Props apokalyptik

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r12128 r12164  
    523523    $newvalue = maybe_serialize( $newvalue );
    524524
     525    do_action( 'update_option', $option_name, $oldvalue, $newvalue );
    525526    $alloptions = wp_load_alloptions();
    526527    if ( isset( $alloptions[$option_name] ) ) {
     
    535536    if ( $wpdb->rows_affected == 1 ) {
    536537        do_action( "update_option_{$option_name}", $oldvalue, $_newvalue );
     538        do_action( 'updated_option', $option_name, $oldvalue, $_newvalue );
    537539        return true;
    538540    }
     
    583585    $value = maybe_serialize( $value );
    584586    $autoload = ( 'no' === $autoload ) ? 'no' : 'yes';
    585 
     587    do_action( 'add_option', $name, $value );
    586588    if ( 'yes' == $autoload ) {
    587589        $alloptions = wp_load_alloptions();
     
    602604
    603605    do_action( "add_option_{$name}", $name, $value );
     606    do_action( 'added_option', $name, $value );
     607   
    604608    return;
    605609}
     
    625629    if ( is_null($option) )
    626630        return false;
     631    do_action( 'delete_option', $name );
    627632    // expected_slashed ($name)
    628633    $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name = '$name'" );
     
    636641        wp_cache_delete( $name, 'options' );
    637642    }
     643    do_action( 'deleted_option', $name );
    638644    return true;
    639645}
Note: See TracChangeset for help on using the changeset viewer.