Skip to content

Instantly share code, notes, and snippets.

@reinier
Created January 10, 2013 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reinier/4504773 to your computer and use it in GitHub Desktop.
Save reinier/4504773 to your computer and use it in GitHub Desktop.
If the incoming post through xml-rpc contains a custom field 'URL', set the post format to 'link'.
<?php
// Add to functions.php
add_action('save_post', 'rei_xmlrpc_process_post');
function rei_xmlrpc_process_post($post_id)
{
if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)
{
$post = get_post_custom($post_id);
if(!empty($post['URL']))
{
set_post_format($post_id,'link');
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment