帮助通过插件拦截save_post
-
16-10-2019 - |
题
我经常使用stackoverflow,只是在Google中发现了这一点,很棒:D
好吧,我想保存我从wordpress写的每篇文章,同时又是我的第三个(oexangeble)网站,因此我需要将信息发送到我的网站,开发插件iguess
我基本上需要 永久链接 (而且我可以从我的Wesite中提取其余的参数),但是如果我能获得标题,标签,永久链接和描述(或其中一些),则更好
我了解我的Google研究,我要做的就是添加类似
<?php
//header of plugin
function myFunctionThatSendsMyWebsite($url){
// procedure containing a file_get_contents('myqwebsite?url=') request to my website
}
add_action('page_post', 'myFunctionThatSendsMyWebsite', $permalink));
?>
我遇到问题,发现我缺少的变量名称(标记为???)。我知道$ post包含所有objet,如何从中提取信息(如果有),或者如果很复杂,那么使用永久链接对我来说足够了
有小费吗?
谢谢!
解决方案
我不确定您要做什么。但是你肯定有点不合时宜 add_action()
. 。应该是这样的:
function myFunctionThatSendsMyWebsite($post_ID, $post) {
// $post_ID and $post will have post's ID and full post object
}
add_action('save_post', 'myFunctionThatSendsMyWebsite', 10, 2);