Wordpress: Function not running when importing posts via RSS

帅比萌擦擦* 提交于 2019-12-08 13:52:20

问题


I am running the following function in functions.php and the code works and updates the custom fields when the post is edited.

function indeedgeo_edit_post($post_id, $post){
    //determine post type
    if(get_post_type( $post_id ) == 'job_listing'){
        //indeed geo split
        $indeedgeo = get_post_meta($post_id, indeedgeo, true);
        $indeedgeos=explode(' ',$indeedgeo);
        $_jr_geo_latitude = $indeedgeos[0];
        $_jr_geo_longitude = $indeedgeos[1];
        update_post_meta($post_id, test1, $_jr_geo_latitude);
        update_post_meta($post_id, test2, $_jr_geo_longitude);
    }
}
add_action('edit_post', 'indeedgeo_edit_post', 10, 2);

However the posts I am wanting to update are actually being imported from an RSS feed by the Autoblogged plugin, which I believe is using XMLRPC to post as these are the hooks it uses:

     // WordPress hooks
     add_filter('xmlrpc_methods', 'autoblogged_xmlrpc');
     add_action("admin_menu", array(&$this, "ab_addAdminPages"));
     add_action('shutdown', array(&$this, 'ab_shutdownIntercept'));
     add_action('wp_footer', 'ab_footer');
     add_action('wp_head', array(&$this, 'on_wp_head'), 1, 1);
     add_action('admin_init', array(&$this, 'on_admin_init'), 1);
     add_action('admin_print_scripts', array(&$this, 'on_load_plugin_admin_scripts'));
     register_activation_hook(__FILE__, "ab_installOnActivation");

My function does not run using the edit_post, save_post or wp_insert_post hooks when these posts are imported from RSS by the plugin. How can I have the function run?

来源:https://stackoverflow.com/questions/10457257/wordpress-function-not-running-when-importing-posts-via-rss

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!