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


//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?


1 Answer 1


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);
  • Thanks, thats completeley true. My first experience with wordpress plugin development. I'll give it a try and let you know :) Commented Feb 25, 2011 at 19:37
  • and if i need permalink? Commented Feb 25, 2011 at 21:19
  • @Toni Michel Caubet to post being saved? You can get it from ID with get_permalink()
    – Rarst
    Commented Feb 25, 2011 at 21:24
  • ok, i'm close! but my code is executed when i click on 'new post' and i'd like to only be when i 'publish post' ? Thanks, by the way! Commented Feb 28, 2011 at 18:24
  • @Toni Michel Caubet hooking for specific action done on post is a little more tricky and complex that it might seem. See Post Status Transitions in Codex.
    – Rarst
    Commented Feb 28, 2011 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.