Jump to content

Recommended Posts

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 by roeeb
line before added
Link to comment
https://forums.phpfreaks.com/topic/322973-help-with-php-wordpress-error/
Share on other sites

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 ?

  • 3 weeks later...

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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.