Question

I use stackoverflow very often and just found out in google about this one, Nice :D

Well, i want to save my every post i write from wordpress to my 3rd (OEXChangeble) website aswell at the same time, so i need to send the info to my website, developing a plugin iguess

I need basically the permalink (and i would be able to extract the rest of the params from my wesite), but better if i can get title, tags, permalink and description(or some of it)

i understand by my google research that all i need to do is add something like

<?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));

?>

I have problems thoug finding the name of variables i have missing (marked by ???). I know that $post contains all objet, how to extract the info from it (if there is), or if it's complicated, it would be enought for me with permalink

Any tip?

Thanks!

Was it helpful?

Solution

I am not entirely sure what you are trying to do. But you are definitely a little off with add_action(). Should be something like this:

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top