There is another question dealing with a slightly more complicated issue than yours, but it contains a lesson.
Basically, what I learned is that you should process your equation in two or more steps, to account for gmt_offset being returned as a string:
$offset = get_option( 'gmt_offset' );
$hours = (int) $offset;
return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( $hours * HOUR_IN_SECONDS ) ) );
This should avoid the error you are seeing.
Good luck!
Related Posts:
- “Can’t use function return value in write context” error
- Programmatically revert to backup .htaccess a possibility?
- Can’t log in to WordPress wp-admin after adding code to functions.php
- Cannot find the php_ini configuration file to find my error log to see why my code is not working
- Site title not showing. Please help me
- Functions are causing errors
- syntax error unexpected ‘}’ at 364 line
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- WP Debug enabled Undefined index error in a widget
- Need help with Deprecated: Non-static error when update PHP 7.4 -> 8.1 with Dyad 2 theme
- How to deprecate a function used in a plugin?
- How to manually fix the WordPress gallery code using PHP in functions.php?
- How to make a image-size selected by default in Media upload – WP v3.5
- Hide main div if wp_nav_menu is empty
- Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?
- adding a filter to a shortcode?
- Change the footer text on the login page
- Can i check if user is doing any ajax request?
- Displaying post per day
- Rewriting search and pagination base
- Copyright info change in Theme Child PHP
- How to Populate the list of custom post type categories
- Php string not working in WordPress Functions.php [duplicate]
- show limited tags in an article
- Understanding WordPress child theme custom JS loading
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- Insert After Second Paragraph Without Tag?
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Create an array from an array
- Using wp_get_image_editor in a standalone script
- Can I change a variable in a content part while calling it?
- page template for attachement page?
- PHP Deprecated: WP_RSSjb has a deprecated constructor
- Shortcode return function with link href inside PHP
- Set WordPress Default Template
- Can’t get page content in WordPress
- Function not working at one place
- Showing content from one page on another
- How to insert a single row to WP database table?
- Get date numerical and separate?
- How to check if a meta value has already been assigned to any user?
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- How to create a php variable using WordPress the_title() function
- How to disable controls in theme customizer?
- register_taxonomy() take much queries
- is there a benefit in using a constant over get_stylesheet_directory_uri?
- WooCommerce Tabs [closed]
- Shortcode with PHP issue “Undefined index”
- ::before on open/close function [closed]
- REQUIRED: get_bloginfo(‘template_url’) was found in the file search.php. Use get_template_directory_uri() instead
- How to check if a PHP string is different than meta field?
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Displaying posts based on category
- Countdown to date function?
- calling a custom field value inside functions.php
- PHP-warning in post-template.php and no loading content on pages
- Noindex Posts From Certain Authors In WordPress
- Show all tags within a category?
- WordPress check if current taxonomy has child
- get post id from wp_insert_post for get_template_part
- This function is deprecated; use mysql_real_escape_string() instead
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Custom Taxonomy Select Menu: Setting default option value?
- How to add author’s posts link (HTML + PHP) inside a function to output it
- How can I alter this code to accept a slug as well as an ID?
- Enqueueing a code block from an options framework
- Conditional On custom field plugin metabox
- Adding a ‘style=’ bit to image_send_to_editor output
- Post Views Code Hacks
- Closing WP_LINK_PAGES DIV ID w/After Argmuent
- Exclude function from running on a certain page
- Auto create Nextgen Gallery on post creation [closed]
- Hide media for non logged in users
- How to set value selected using select2 jquery plugin
- Jetengine Forms – Media upload path
- Using ACF Relationship field to set post type to draft or published status
- Custom function that re-writes page title breaks when the Yoast plugin is activated
- is_front_page is not working in my functions.php
- Is it possible to update the dataset using update_post_meta
- update_user_meta as multiple value but with same meta key
- Hide payment method based on user role AND minimum cart value
- Update $wpdb query with AJAX
- Permalink changes after several minutes after saving post
- how to use auth_redirect() redirect visitor to login page if they are not login when they click account and order page?
- All categories options or All categories not Populating
- WordPress load javascript file if something… (after the page is loaded)
- Add class for the_post_thumbnail_caption()
- Wrapping shortcode content in a span or link
- Permission functions within wordpress
- Adding ID to a Listing but not inside WP_Query while
- WordPress display name string manipulation
- 2 small questions: How to redirect to a created page & show that pages title in wp, bp
- How do I get Roboto Google Font to display normal font-style? [closed]
- How to handle PHP parse errors?
- which table updated after logout?
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- Loop on a wordpress Page instead of content coming from the WP text editor
- Saving User Input to PHP Variable
- Undefined variable notice [closed]