Skip Navigation

[Resolved] Copy / Update posts of custom post type with custom fields in multisite network

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to clone a post from one site in my multisite network into another site in the same network using the WP Multisite Content Copier Pro plugin. This plugin allows me to clone a post across sites and was working as expected, but recently stopped working.

Solution: In this case exposing the custom fields to the REST API seems to have solved the problem. Manage that setting in Toolset > Settings > Custom Content. Check the checkbox for "Expose custom fields managed by Types for posts, users, and terms through the REST API" and save the settings.

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by andyB-12 3 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#2067441

Hey there,
I set up a multisite with toolset and at the moment it is working fine, but the customer wants to be able to creat a blog post on one of the networks website and copy / clone it to other websites of the multisite network. I found this plugin: hidden link which worked fine at the start, but now it does not copy the Toolset fields anymore. So if checkboxes are selected in the first post, those are not selected in the copied post. The fields have the same naming on all sites. Is there anything how you could help me with that or any function within Toolset that could help me out? I cant find the solution for this problem.

#2068245

Hello, I am not really familiar with this specific plugin and there is no direct integration with Types, so I don't have much information available for you. The Types field PHP API does not function across networked sites, it only allows you to render custom field values from the current site.
- Have you asked their support team for assistance with a feature that once worked but has suddenly stopped working? Do they have any additional information available about why the feature stopped working?
- If the plugin implements the REST API, you may need to expose each custom post type to the REST API to enable the plugin to access that CPT for cloning purposes. You can enable REST API connections for a CPT in Toolset > Post Types. Edit the CPT you want to enable, and open the Options panel. Turn on the show_in_rest option and save the post type settings.
You may also need to expose custom fields to the REST API. You can do that in Toolset > Settings > Custom Content. Check the checkbox for "Expose custom fields managed by Types for posts, users, and terms through the REST API" and save the settings.
- To access Types custom field values in the database, you must use the wpcf- slug prefix. If their plugin uses get_post_meta() to get custom field values, any Types field slugs in get_post_meta calls must include the wpcf- slug prefix. So if the Types custom field slug in wp-admin is address, then you would access that field like so:

get_post_meta($post_id, 'wpcf-address', true);

Those are the main things I can think of. I think the other plugin's support team is better qualified to tell you why their system suddenly stopped working as expected. I'm just guessing, unfortunately, and I don't have any truly useful information about their plugin.

#2073835

Hey Christian,

as I am working with Blocks, the Rest API setting was already enabled for post types, but I enabled the Rest API for custom fields and it seems this did do the trick. At the moment the plugin clones posts as it should.

Thanks a lot for your help!

#2089365

Hey there,

unfortunately that works fine for one of the post types, but does not work for another. So for me it seems, there has to be a problem within Toolset, if the other plugin works fine with one post type, but not with another?

You can see all post types here (green works with copier, red does not):
hidden link

I checked all settings and all have the REST_API enabled and the custom fields have all the same slugs on all sites of the network.

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/copy-update-posts-of-custom-post-type-with-custom-fields-in-multisite-network-part-2/