I am using a WordPress plugin. Everything work fine. Exect when open a 404 page, I got this notice:
Notice: Trying to get property of non-object in D:\MYWEB\InstantWP_4.3.1\iwpserver\htdocs\wordpress\wp-content\plugins\sama-author-review\user-rate.php on line 49
Line 49 looks like this:
'nonce' => wp_create_nonce('ajax-user-rate-nonce-'. $post->ID)
Here the code:
/**
* enqueue scripts used in frontend
*
*/
function sama_enqueue_scripts() {
global $post, $sama_author_review;
$ajax_vars = array(
'url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce('ajax-user-rate-nonce-'. $post->ID)
);
// see author-review.php
wp_localize_script( 'review', 'ajax_user_rate', $ajax_vars );
}
Is there a quick fix to resolve these error?