In a theme I'm developing, I need to link to the source post when the post has been stored using XMLRPC. That implies that every time Wordpress asks for a permalink (using get_permalink()) the theme will return a previously saved link. That's accomplished by adding a new filter:

add_action('the_permalink', 'filterPermalink');

function filterPermalink($url) {
    $permalink = get_previously_saved_permalink(get_the_ID());
    return $permalink? $permalink : $url;

That's not the problem (by the moment). The problem is, how to make the same with the metaWeblog.newPost function.

I've already tried something like this:


function xml_rpc_functions_to_add($args) {
    $args['metaWeblog.newPost'] = 'add_permalink';
    return $args;

function add_permalink($args) {
    // Do it

What I need is to know how to call the previous 'metaWeblog.newPost' from 'add_permalink'.

  • You're trying to do two things. Your working code calls get_previously_saved_permalink() to replace the standard link with one saved elsewhere (post meta perhaps). But now you're trying to hook in to save a different permalink via XMLRPC?
    – EAMann
    May 21, 2012 at 21:10
  • The idea is simple: assign a source link (given by XMLRPC protocol) to each post so the permalink filter could read and use it. Now I've get add_permalink to work, I've edited the question removing the text where I said that wordpress was not executing this part.
    – Ivan
    May 22, 2012 at 8:49

1 Answer 1


From look at source metaWeblog.newPost seems to be processed in wp_xmlrpc_server->mw_newPost() method.

At the end of this method there is following hook call:

do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args );

which seems to be very fitting to process and save any additional information for post that have just been created by its ID provided.

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.