Title: wp_timezone_override_offset
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_timezone_override_offset(): float|false

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#wp--skip-link--target)

Modifies gmt_offset for smart timezone handling.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#description)󠁿

Overrides the gmt_offset option if we have a timezone_string available.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#return)󠁿

 float|false Timezone GMT offset, false otherwise.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#source)󠁿

    ```php
    function wp_timezone_override_offset() {
    	$timezone_string = get_option( 'timezone_string' );
    	if ( ! $timezone_string ) {
    		return false;
    	}

    	$timezone_object = timezone_open( $timezone_string );
    	$datetime_object = date_create();
    	if ( false === $timezone_object || false === $datetime_object ) {
    		return false;
    	}

    	return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/functions.php#L6548)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/functions.php#L6548-L6561)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#related)󠁿

| Uses | Description | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/?output_format=md#comment-content-6509)
 2.   [Echo](https://profiles.wordpress.org/egregor/)  [  3 years ago  ](https://developer.wordpress.org/reference/functions/wp_timezone_override_offset/#comment-6509)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_timezone_override_offset%2F%23comment-6509)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_timezone_override_offset%2F%23comment-6509)
 4. This is hooked into the `pre_option_gmt_offset` filter.
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_timezone_override_offset%2F%3Freplytocom%3D6509%23feedback-editor-6509)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_timezone_override_offset%2F)
before being able to contribute a note or feedback.