Does anyone know if the wp_options table have modified timestamps for their options? I have an option that has an object as the option value as shown below:

enter image description here

The "Access Token" within the option value object gets updated frequently and I'd like to check when "instagram" has been modified and return the timestamp.

If not, would you say it would be easier to just set an object key as modified and save the current time?

Thanks all! I'd like to do it as native as possible with get_option() or such before I save an extra key.

1 Answer 1


There's no "updated" column in the wp_options table.

mysql> describe wp_options;
| Field        | Type            | Null | Key | Default | Extra          |
| option_id    | bigint unsigned | NO   | PRI | NULL    | auto_increment |
| option_name  | varchar(191)    | NO   | UNI |         |                |
| option_value | longtext        | NO   |     | NULL    |                |
| autoload     | varchar(20)     | NO   | MUL | yes     |                |
4 rows in set (0.07 sec)

If you need to know when an option was updated, you'll need to inject that information into the option itself. If you're managing the code, it's easy enough: just add a new field to the array that you're saving.


        'username' => 'semirtravels',
        'user_id'  => '{your user ID}',
        // ...
        'last_updated' => time(),

If not, you might be able to intercept it using the pre_update_option_{$option} filter hook:

add_filter( 'pre_update_option_instagram', 'wpse_400857_add_updated_time', 10, 3 );
 * Adds the current time() to the value of the `instagram` option.
 * @param  mixed  $value     The option's value.
 * @param  mixed  $old_value The option's previous value.
 * @param  string $option    The option name.
 * @return mixed             The filtered option value.
function wpse_400857_add_updated_time( $value, $old_value, $option ) {
    $value['last_updated'] = time();
    return $value;
  • 1
    Thanks so much! This worked! I was able to just push the last_updated to the associative array and infuse it within get_option.
    – theMap
    Commented Jan 3, 2022 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.