We are trying to create a repeatable fields group but when we create a new custom fields gropu and assign it to only a post type as explained in the tutorial , we do not see the red button to add a repeatable field but we only see the button "add a new field".
We attach a screenshot. Texts are in italian but they are self explaining.
Kindly let us know what could be wrong.
Thanks
Franco
Hi, it looks like the updated relationships feature is not active on this site. Please go to Toolset > Relationships. You will see:
1. A dashboard list of post relationships.
- OR -
2. A message telling you to migrate to the new post relationships system.
If you see #1, something strange is happening because this is not normal. I must take a closer look. If you see #2, this indicates your site was built before the new post relationships system was introduced in Types 3, and you have not migrated to the new system yet. To use repeatable field groups (RFGs) and other post relationship features, you must run the post relationship migration process.
I recommend you make a full backup of your site including the database before migrating to the new post relationships system. More information about relationship migration: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/
Hi Christian, we did not migrate Toolset to the new system, we will do a backup and start the migration process, after that we will let you know if the new repeatable group fields are working.
Best,
Franco
Hi Christian,
we made a full site backup and started the migration process, when the setup started we got the message you see in the attached screenshot.
It seems that some custom code is not backward compatible to the new migration, since maybe it is something that we asked you to create in the past support tickets is it possible for you to investigate if something from the screenshot suggests how to change that code to be backward compatible?
The alert we got from the migration process says that it could be a false alarb but we need to check it before proceeding with the migration.
If you need further info, kindly let us know.
Thanks in advance for your great support.
Franco
Okay I see the message. The code referenced here must be adjusted to work in the new relationships system. It does not matter if we perform this change immediately before the migration or immediately after, but it should be performed together with the migration. I need to see the functions.php file to know exactly which changes should be made. Please zip up your functions.php file and post it in Dropbox or Drive and post a download link here for me. I'll review the code and follow up with you soon.
Hi Christian,
please allow me a private reply so I can send you the link of the .zip file.
Thanks.
Franco
Sure, private reply is enabled here. The fields may say something about a Duplicator clone, but any download link is fine.
Okay it turns out we need to know the slugs of the new post relationships to be able to finish this code modification. So I would activate maintenance mode to take the site offline, then run the migration. Once you have run the migration, go to Toolset > Relationships and find the slugs of the two one-to-many relationships. Replace studi-relationship with the new studi relationship slug, and replace scheda-relationship with the new scheda relationship slug. Then replace the existing function in functions.php with this one before opening up the site again:
add_filter( 'wpv_filter_query', 'filter_both_parent_types', 10, 3 );
function filter_both_parent_types ( $query, $view_settings, $view_id ) {
global $post;
$views = array( 113600, 113684 );
$studi_rel = 'studi-relationship';
$scheda_rel = 'scheda-relationship';
/* -- do not edit below here -- */
if( in_array( $view_id, $views) ) {
$studi_id = $post->ID;
$scheda_id = $query['post__not_in'][0];
$args = array(
array(
'role' => 'child',
'related_to' => $studi_id,
'relationship' => $studi_rel
),
array(
'role' => 'child',
'related_to' => $scheda_id,
'relationship' => $scheda_rel
)
);
$query['toolset_relationships'] = $args;
}
return $query;
}
Then test out the View and make sure it's working as expected.
Hi Christian, thanks for your help. I will do all things as you requested and let you know if everything wil be OK.
I will do that in the following days because I have to check first with the client when it will be the best moment to put the site in manteinance mode.
Anyway thanks for your great help as usual 🙂
I would keep this ticket open until the migration will be made if you don't mind.
Best,
Franco
Sure, no problem. The system will prompt you to update the ticket in a few days to keep things open.
just to keep the ticket open, next week we will do the upgrade of Toolset plugins.
thanks
Franco
No problem, thanks for the update.