So, don't expect to do anything with the return value for this function. I want to get the user ID that is currently logged in. There are many reasons why to get the current user data in WordPress: Display different content to each user based on his role. For the sake of completeness, here's how you would access a similar pluggable function from within the context of your own plugin: (put this inside a .php file inside your plugins folder). get_userdata() | Function | WordPress Developer Resources Removes all session tokens for the current user from the database. A success function is put into place, which will replace the button with the already . Note: If called with the id or name parameter, the constructor queries the (wp_)users table. If id is empty it reads by login name. Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site. WordPress. where is file located or can you tell me the file structure. The API uses nonces with the action set to wp_rest. Removes all of the cookies associated with authentication. There are basically two options. There are several way's to get current page name WordPress The most simple solution is to use the get_post_field function. Renames $_POST data from form names to DB post columns. Have you tried: Simply add this function to your plugin .php file. Maybe, can I use WP library functions or WP Rest-Api? Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Prints JavaScript settings for parent window. I was insterting my script in html