Hello,
I have a Cred user form that creates new users and allow them a specific role. In the same time, I need to add some information to a specific table (different from wp_user or wp_usermeta)
Prior to create the cred_save_data into the function.php, I'm trying to test the code by creating a specific page and call it directly. So, I created the wpupdate.php page in the directory root and can lunch it thnaks to hidden link
Now, here is the code I have inserted in this page :
and got this error :
Fatal error: Call to a member function update() on null in /home/my_site/wpupdate.php on line 15 (line 15 is the line with the update function)
It is just a PHP file at a URL that happens to be in the directory where you have WordPress installed, but you accessing that file directly and WordPress is not invoked.
Try using the plugin Code Snippets. You can add PHP snippets to it and it recently added the ability to run some code just once, for cases like this where you need to update something in the database on a one time basis.
I understand. In fact, I dont need to use a page as the aim is to test a function before placing it into a cred_save_data
What would be the best way to manage this test without managing a full page for this?
Use Code Snippets and run your code one time only, to test the function so that you can inspect the database and see whether it was updated as you expect.