Please revert your WP core file and create a plugin instead. For this type of functionality, you can use the Publish Post hook.
Assuming your custom table is in the same database as WordPress, and you want to save the email address of the current user:
add_action('publish_post', 'update_my_custom_table');
function update_my_custom_table() {
$current_user = wp_get_current_user();
$email = $current_user->user_email;
global $wpdb;
$addInfo = $wpdb->insert('wp_custom_table', "$email");
}
Hopefully this will get you started down the right path, so you can insert whatever data you’re trying to add. There may be a better way than adding your own table, depending on what you’re trying to accomplish, but you didn’t mention much about your goal for the data.
Related Posts:
- Organizing Code in your WordPress Theme's functions.php File?
- Admin Page Redirect
- Disable dragging of meta boxes?
- How to remove screen options and help links in the admin area?
- Sort admin menu items
- Custom column for changing post status via ajax
- Make fonts.com font work in TinyMCE (iframe referrer issue)
- How to remove items from +New admin menu?
- Make sub menu items a main link in the admin menu using fuctions.php
- Add column to pages table
- Admin account only shows Profile and Dashboard with no activity
- Can initial focus be set to search field in WordPress Media Library?
- wp-admin – save options without refreshing?
- How do you modify CSS files via admin panel?
- How to prevent parent admin page from appearring as a child admin page
- Change WP-Login or WP-Admin
- SSL Partially breaking admin panel and elementor
- What is the practical difference between is_admin() and is_blog_admin()?
- How do I set the homepage to the WordPress Admin Dashboard login?
- Create a admin page in wordpress without admin menus (“wordpress sidebars”)
- How to hide wordpress default description box?
- I want to disable login of admin (/wp-admin) with email and make it accessible only with username
- Allow administrators to pick post author on custom post type edit screen
- How to make the front-end RTL without changing the admin panel language?
- Add column to pages table
- What are the requirements to make the admin toolbar show up on the front end
- Remove bulk option row
- How to replace “Password Protected” text with icon in Admin
- Hooks: admin_footer and admin_print_footer_scripts not working?
- Can’t access wp-admin, redirects to http://%24domain/wp-admin/
- What is the correct way to get only display plugin for Administrator Only
- Admin top level menu, pointing to an external url
- Browse Happy in 3.2
- How to break line / add to ADMIN menu
- External HTTP API calls slowing down WordPress admin [closed]
- Outputting something based on the presence of post variable in admin screens
- Creating custom admin panel pages without making a plugin?
- Dashboard : remove Safari navigator message
- Available resources for learning WordPress 4.7.2 from the ground up?
- Uncaught SyntaxError: Unexpected Token Illegal
- Newly created user role not displaying on users screen
- WordPress Admin extremely slow when other admin logged in
- WordPress Admin Panel Left Sidebar No showing on Post create page
- Accessing wordpress tool in local MAMP Site
- How to remove Google fonts from wp-admin (Roboto) added by core
- Trying to login to my site redirects me to the first page
- Admin Login Checks
- Failed to load resource: the server responded with a status of 431 ()
- When installing wordpress through WP CLI mysite.com/admin not working
- Localhost install: Administrator lost administrator access; cannot access Dashboard
- Admin Login page not working at all
- Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
- Why when I click on a link into the WP admin panel I am redirected to a link that doesn’t contains wp-admin prefix, so I obtain 404 error
- Override WordPress Core File?
- How to make the Panel // WP-Admin lighter via Mobile
- Can I rename the wp-admin folder?
- What are the standard admin CSS id/class tags?
- Set Default Admin Colour For All Users
- I’m getting a 404 message when I try to access wpadmin
- wordpress wp-admin css not loading
- How do I find all admin users using phpmyadmin?
- wp-admin produces a 302 redirect to itself
- Restrict access to admin but allow admin_post hook
- How to set custom editor style when editing the homepage?
- Login to wp-admin “redirect_to” points to wrong URL after migration
- TinyMCE Autoresize
- WordPress wp-admin suddenly lost its style
- Create Read Only Admin
- How can I add my script to admin using script-loader.php?
- Why am I unable to login after converting to www?
- why my menu is not appearing on the admin panel
- Adding text in more than one language (at the same time)
- Subscribers become Authors after Upgrade? / Mass Update of Users?
- Redirect loop in /wp-admin/
- Add javascript confirmation popup on “Move to Trash” link
- Create custom fields as image uploads [duplicate]
- 404 error comes up when I go to wp-admin after first installation [closed]
- Is there a quick way to find out what posts haven’t been tagged?
- WordPress isn’t reflecting changes I make to a specific file via FTP [closed]
- Cannot Access wp-admin as redirects to wp-signup.php?
- Screen Options & Help Buttons not working when including Bootstrap Css
- edit.php alter links
- Cannot access WordPress login pages
- Restrict submitters from wp-admin [duplicate]
- Restrict access to admin-post.php
- How do I add something to the “Edit Tag” page in wp-admin?
- How to make sure your admin doesn’t hi-jack you site?
- How do I make it so that the all users page is not a white screen?
- Show shipping class on product admin page
- Detail view for an element in a list the admin site
- How to load Dashboard default media files via HTTPS even when Browser URL has HTTP
- wp-admin redirects to standard wordpress page
- OSX El Capitan local install Maximum upload file size: 2 MB But php.ini set to 64M
- Wp mwnu not works at all
- Can’t log into WordPress after domain change
- Custom Admin Message from external source to multiple users
- Show parent-child relationship for categories in the wordpress admin
- How can visitors redirect wp-admin to the homepage?
- Creating your own options-general.php page
- You do not have permission to access this document on form submit