- This topic has 4 replies, 2 voices, and was last updated 1 week, 3 days ago by .
I have the following code which isn't working - I wonder if you could highlight where I'm going wrong (or even if what I'm trying to do isn't possible this way).
switch_to_blog(1); $post_id = wp_insert_post($new_job); echo "Post and User IDs - " . $post_id . " - " . $job_data['user_id'] . "\n"; MB_Relationships_API::add( $post_id, $job_data['user_id'], 'jobs_to_clients'); restore_current_blog();
The user and the post are created on one site in a multisite setup and applied to another site. This is working fine. The user is created in the network and added to the other site correctly. The post (CPT) is created in the code above and correctly appears in the other site and both have all their custom meta data working properly.
The only bit that isn't working is the addition of the relationship which I need to have. I don't get an error but the relationship isn't being set.
- You must be logged in to reply to this topic.