-
Hi
For users who use solar date in WordPress, the following error occurs in this version of your plugin:Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (۱۳۹۹-۰۷-۱۸ ۰۰:۰۰:۰۰) at position 0 (�): Unexpected character in /home/demow/public_html/wp-content/plugins/seo-by-rank-math/includes/class-helper.php:79 Stack trace: #0 /home/demow/public_html/wp-content/plugins/seo-by-rank-math/includes/class-helper.php(79): DateTime->__construct('\xDB\xB1\xDB\xB3\xDB\xB9\xDB\xB9-\xDB\xB0\xDB\xB7-\xDB...') #1 /home/demow/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/analytics/class-stats.php(93): RankMath\Helper::get_midnight('\xDB\xB1\xDB\xB3\xDB\xB9\xDB\xB9-\xDB\xB0\xDB\xB7-\xDB...') #2 /home/demow/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/analytics/class-stats.php(75): RankMath\Analytics\Stats->set_date_range() #3 /home/demow/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/analytics/class-analytics.php(55): RankMath\Analytics\Stats::get() #4 /home/demow/public_html/wp-content/plugins/seo-by-rank-math/includes/module/class-man in /home/demow/public_html/wp-content/plugins/seo-by-rank-math/includes/class-helper.php on line 79
Please make the following changes in the class-helper.php file on line 75-83 to fix this :
public static function get_midnight( $time ) { if ( is_numeric( $time ) ) { date_default_timezone_set(get_option('timezone_string')); $time = date( 'Y-m-d H:i:s', $time ); } $date = new \DateTime( $time ); $date->setTime( 0, 0, 0 ); return $date->getTimestamp(); }
your code :
public static function get_midnight( $time ) { if ( is_numeric( $time ) ) { $time = date_i18n( 'Y-m-d H:i:s', $time ); } $date = new \DateTime( $time ); $date->setTime( 0, 0, 0 ); return $date->getTimestamp(); }
thank you : https://wp-yar.ir
The ticket ‘bug in rank math v1.0.49’ is closed to new replies.