且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Wordpress:保存或编辑帖子时执行功能

更新时间:2023-11-30 13:59:10

将以下内容放入主题的functions.php文件中.它将同时保存和更新.由于您拥有职位ID,因此您可以做任何您想做的事情.

Put the following in your functions.php file of your theme. It will run on both save as well as well update. Since you have the post ID, you can do whatever you want.

function do_my_stuff($post_ID)  {
   //do my stuff here;
   return $post_ID;
}

add_action('save_post', 'do_my_stuff');