Adding a custom field from content_save_pre filter through XMLRPC
-
Is it possible to add a custom field from a content_save_pre filter? I’m trying to detect some fields being typed in the post content, e.g. [something]Thing[/something], and then set a custom field to “Thing”.
The following code works fine when posting through the web interface, but fails on the clients I’ve tried (MarsEdit and WordPress iOS) — the [] tags get removed, but the custom field doesn’t get set.
function dfll_get_link($post_content) { $dflink = dfll_find_link($post_content); if ($dflink) { global $post; $post_id = $post->ID; update_post_meta($post_id, 'linked_list_url', $dflink); } $temp = '/(' . dfll_regesc('[ll]') . '(.*?)' . dfll_regesc('[/ll]') . ')/i'; $post_content = (preg_replace($temp, '', $post_content)); return $post_content; } add_filter('content_save_pre', 'dfll_get_link');(Assume the other functions are defined.)
This is for my Daring Fireball-style Linked List plugin. Code above adapted from Justin Blanton’s Slugger+ plugin.
The topic ‘Adding a custom field from content_save_pre filter through XMLRPC’ is closed to new replies.