QQ邮箱内有个订阅功能,订阅后,发布人可以随便对订阅者发布信息,而且还可以通过FEED订阅,将信息发送出去,时间可以每天一次汇总等。但是,这个每次发布新文章都会……功能略变态。
将以下代码放进functions.php中即可
function newPostNotify($post_ID) { if( wp_is_post_revision($post_ID) ) return; global $wpdb; $get_post_info = get_post($post_ID); if ( $get_post_info->post_status == 'publish' && $_POST['original_post_status'] != 'publish' ) { // 读数据库,获取所有用户的email $wp_user_email = $wpdb->get_results("SELECT DISTINCT user_email FROM $wpdb->users"); // 依次给每个Email发邮件 foreach ( $wp_user_email as $email ) { // 邮件标题:幻杀博客有新文章 $subject = '幻杀博客有新文章'; // 邮件内容:新文章网址:+ URL $message = '新文章网址:' . get_permalink($post_ID); // 发邮件 wp_mail($email->user_email, $subject, $message); } } } // 钩子,一旦WordPress有新文章发布或文章被修改即刻执行newPostNotify函数 add_action('publish_post', 'newPostNotify');
但是只对注册账户发送,略修改可对全部留言人发送,不过不建议!留言人多的时候,你就可以呵呵了!
174943 65307Some truly howling function on behalf with the owner of this website , dead great subject matter. 503859
2018年8月18日 05:06687440 389895Hiya! awesome blog! I happen to be a every day visitor to your web site (somewhat much more like addict ) of this web site. Just wanted to say I appreciate your blogs and am seeking forward for much more to come! 545373
2018年8月14日 04:36长时间就成垃圾邮件了
2015年3月26日 20:45嗯
2015年3月27日 12:20思路没问题
2015年3月27日 20:42不过多了的确会进垃圾箱。
2015年3月27日 21:51那没办法,不过这种办法现在应该少了吧
2015年3月27日 23:01都用插件,
2015年3月27日 23:55虽然发现很晚了,不过还是支持一下。
2015年3月23日 14:55这个已经有了,哈哈
2015年3月23日 13:25看到了,不过,垃圾箱……
2015年3月23日 18:37我也搜到你的了,也是垃圾箱。。
2015年3月27日 16:39好吧,都进垃圾箱了
2015年3月27日 20:10拦截之
2015年3月23日 12:35不建议用啊,别人既然会关注你肯定会长期来你博客或者feed订阅的,这样有的人不愿意会引起厌烦,,
2015年3月22日 16:49我注册账户全部被我咔嚓了
2015年3月22日 16:51自作孽啊。。
2015年3月22日 16:55被人恶意注册过,气的我直接SQL全删了
2015年3月22日 16:56恩 可以试试
2015年3月22日 16:37好像去年有人分享这个可以给留言的发送后,我这边也经常收到这种的邮件
2015年3月22日 16:32给留言的发送修改一下就好了
2015年3月22日 16:34