Wordpress adding data to table (database)
I have a custom table in my WordPress database named "post_votes" used for voting posts.
Whenever I publish a new post ca开发者_如何学编程n I simultaneously add some data to that table as well?
I'm trying to achieve this without editing any wp core files. Perhaps a function if possible.
You'll want to register a function in your plugin to this action hook:
{$new_status}_{$post->post_type}
精彩评论