@hube2 I now have it working with it checking the post type before running the function and it still has this unable to convert to string error when I update the custom post from both WP admin and the frontend. I think the probably is related to the 'user_'.$user_id);