Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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);
share|improve this answer
    
Thanks, thats completeley true. My first experience with wordpress plugin development. I'll give it a try and let you know :) –  Toni Michel Caubet Feb 25 '11 at 19:37
    
and if i need permalink? –  Toni Michel Caubet Feb 25 '11 at 21:19
    
@Toni Michel Caubet to post being saved? You can get it from ID with get_permalink() –  Rarst Feb 25 '11 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! –  Toni Michel Caubet Feb 28 '11 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 Feb 28 '11 at 18:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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