roeeb Posted August 10 Share Posted August 10 (edited) Hi, When I enter my site and try to post new post I get this error below: Fatal error: Uncaught TypeError: Unsupported operand types: string * int in /home/cksqu69nvy57/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:1806 Stack trace: #0 /home/cksqu69nvy57/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(569): WP_REST_Posts_Controller->prepare_item_for_response() #1 /home/cksqu69nvy57/public_html/wp-includes/rest-api/class-wp-rest-server.php(1230): WP_REST_Posts_Controller->get_item() #2 /home/cksqu69nvy57/public_html/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request() #3 /home/cksqu69nvy57/public_html/wp-includes/rest-api.php(555): WP_REST_Server->dispatch() #4 /home/cksqu69nvy57/public_html/wp-includes/rest-api.php(2922): rest_do_request() #5 [internal function]: rest_preload_api_request() #6 /home/cksqu69nvy57/public_html/wp-includes/block-editor.php(750): array_reduce() #7 /home/cksqu69nvy57/public_html/wp-admin/edit-form-blocks.php(77): block_editor_rest_api_preload() #8 /home/cksqu69nvy57/public_html/wp-admin/post-new.php(72): require('/home/cksqu69nv...') #9 {main} thrown in /home/cksqu69nvy57/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 1806 first error line 1806: $post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ); } else { $post_modified_gmt = $post->post_modified_gmt; } $data['modified_gmt'] = $this->prepare_date_response( $post_modified_gmt ); any one have idea why this happens and how to solve it ? Thanks, Roee Edited August 10 by roeeb line before added Quote Link to comment https://forums.phpfreaks.com/topic/322973-help-with-php-wordpress-error/ Share on other sites More sharing options...
gizmola Posted August 10 Share Posted August 10 It looks like you do not have a valid timezone setting either for the php configuration, or wordpress or both. Fix that and this error will likely go away. Quote Link to comment https://forums.phpfreaks.com/topic/322973-help-with-php-wordpress-error/#findComment-1632373 Share on other sites More sharing options...
roeeb Posted August 11 Author Share Posted August 11 how to fix this on php ? Quote Link to comment https://forums.phpfreaks.com/topic/322973-help-with-php-wordpress-error/#findComment-1632423 Share on other sites More sharing options...
roeeb Posted August 11 Author Share Posted August 11 tried on date.php <?php /** * Class for generating SQL clauses that filter a primary query according to date. * * This file is deprecated, use 'wp-includes/class-wp-date-query.php' instead. * * @deprecated 5.3.0 * @package WordPress */ _deprecated_file( basename( __FILE__ ), '5.3.0', WPINC . '/class-wp-date-query.php' ); date_default_timezone_set('Asia/Jerusalem'); $currentTime = date('Y-m-d H:i:s'); /** WP_Date_Query class */ require_once ABSPATH . WPINC . '/class-wp-date-query.php'; added marked line in red - didn't help ? Quote Link to comment https://forums.phpfreaks.com/topic/322973-help-with-php-wordpress-error/#findComment-1632424 Share on other sites More sharing options...
edwardjacksan Posted August 27 Share Posted August 27 It looks like you're encountering a PHP error related to data type issues in your WordPress setup. This could be due to a plugin or theme conflict, or an issue with the data being processed. Here’s a quick fix: Disable Plugins: Temporarily deactivate all plugins to see if the error resolves. If it does, reactivate them one by one to identify the culprit. Switch Themes: Change your theme to a default WordPress theme to rule out theme-related issues. Update PHP: Ensure your PHP version is compatible with your WordPress version. Check for Updates: Make sure WordPress, themes, and plugins are all updated to their latest versions. If these steps don't resolve the issue, you might want to consult a website developer for more in-depth assistance. Hope this helps! Quote Link to comment https://forums.phpfreaks.com/topic/322973-help-with-php-wordpress-error/#findComment-1633868 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.