I have very few knowledge on oo php and databases, and I am simply trying to insert data in my wp_pagesvisites table but I am having some trouble with this error message.

This is my script:

        'Adresse_IP' => $ip,
        'Post_ID' => $id,
        'Timestamp' => $time

Thanks for helping!

1 Answer 1


$wpdb is a global variable. You have to take it into your function’s scope first …

global $wpdb;

… or access it per $GLOBALS


And I would use always lowercase keys; this is just a useful convention.

  • I did same but still getting the same issue Nov 27, 2019 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.