wordpress-parsi / wp-parsidate

Integrates the Solar Hijri (Persian) calendar in WordPress.
https://wp-parsi.com
GNU General Public License v2.0
52 stars 28 forks source link

Update fixes-dates.php #201

Closed callmeahmedr closed 3 weeks ago

callmeahmedr commented 3 weeks ago

Here's the updated line: $post_id = (is_object($post) && isset($post->ID)) ? $post->ID : null;

This change adds a check to ensure $post is an object before accessing its ID property. If $post is not an object, $post_id will be set to null, avoiding the warning.

Previously $post->ID was being accessed, but it appears that $post might be an integer or something other than an object, leading to the warning.

$post_id = ! empty( $post ) ? $post->ID : null;

man4toman commented 3 weeks ago

Nice catch, thanks @callmeahmedr