Skip Navigation

[Resolved] I can’t delete a Repeatable Group in the Post Field Group page

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

Problem: When the Church Content plugin is active, I cannot delete a repeatable field group (RFG) because the slug is modified to add "-2" at the end of the current slug. This happens automatically.

Solution: The conflict seems to occur when the Church Content plugin is active. You can temporarily deactivate the plugin while editing RFGs, permanently deactivate the plugin and recreate its functionality elsewhere, or add a custom filter-based workaround:

add_filter( 'wp_unique_post_slug_is_bad_flat_slug', '__return_false', 11 );
This support ticket is created 4 years 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 9 replies, has 3 voices.

Last updated by Christian Cox 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#2132971

I am trying to: Configure a Repeatable Field Group

Link to a page where the issue can be seen:
CMS - hidden link
Outside page example - hidden link

I expected to see: A repeatable field group after the Teacher's Activity Plan box

Instead, I got: No group visible.

I've tried to create several RFGs. Each time I save the CMS Edit Post Field Group page it adds a number after the field slug in the RFG and continues to add one each time I save the Post Field Group. If I add data to the field group in the custom post type, it doesn't save when I save the page.

I've tried 3 times to add an RFG with the same problems each time and I'm unable to delete any of the RFGs I've created.

The custom post type I'm working with is called Learning Bundles.

This is a live site so please be careful when assessing the issue.

Many thanks in advance,
Paul

#2133529

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Paul

I took a look at your site, I can see several repeatable field groups registered for Learning Bundles, and when I tried to edit a Learning Bundle post and add some content to one of the repeatable field groups, it didn't save the data when I updated the page.

I'm reluctant to do much more on an production site.

Do you have a staging server where we would be free to test? (The first thing I'd like to do is disable all non-Toolset plugins and switch theme, to rule out some compatibility issue interfering in the process.)

If not, can you make a copy of the site available?

You can use Duplicator, as described here: hidden link

Or you may find All in One WP Migration easier to use, just be sure to exclude the media library when creating the package to reduce its size.

You can share a link to the archive on dropbox or similar here, the link will be hidden from other users.

#2133747

Hi Nigel, thanks for getting back to me quickly.

I've got a pre-live dev site with the same issues that you can use, however without the Learning Bundles post type in it. But the same issue appears under the Field Group for Business. Feel free do whatever you need to on this site. You can access this cms using the same login details as I sent through for the other site.

hidden link
hidden link

Many thanks,
Paul

#2133869

Hi I just ran a quick test in the dev site and wanted to give you a quick update.
- First, I deactivated all non-Toolset plugins and activated the default Twenty Twenty theme.
- Next I edited the Field Group for Businesses and tried to add a select field to the Business Image Gallery RFG. When I tried to save the Field Group, I saw a validation error message "Please enter no more than 20 characters" in the slug field of the Business Image Gallery RFG. So I corrected that slug and was able to save the Field Group successfully. I refreshed the page and the select field I added was still present, so it seems that I was able to add a new field to the RFG.
- Then I created a Draft Business post here: hidden link
- I added one Business Image Gallery RFG and chose one of the options in the select field I added. I saved the post successfully, then refreshed the page. The RFG I created is still present, and the option I selected in the select field is still selected. So this simple test seems to be successful. I'll run a few more tests and give you another update shortly.

#2133907

I've tried to create several RFGs. Each time I save the CMS Edit Post Field Group page it adds a number after the field slug in the RFG and continues to add one each time I save the Post Field Group. If I add data to the field group in the custom post type, it doesn't save when I save the page.
Okay I think I've narrowed down the source of this issue. The plugin Church Content seems to be responsible for this problem on the dev site. I first tested with a default theme and only Toolset plugins active, and didn't experience this problem. But when I reactivated the theme and other plugins, I was able to see the same problem. The RFG slugs began to show with a trailing -2 any time I made a change in the field group. I was able to iteratively remove and add plugins back to the mix, and found that disabling the Church Content plugin solved this problem. After disabling the plugin, I had to edit the Field Group again and resave the RFG slugs back to their original slugs. Then I was able to add and delete fields and RFGs again without experiencing errors. I've left the Church Content plugin deactivated on the dev site for now, so you can test if you'd like. Once you're satisfied feel free to reactivate the plugin in dev.

Next, I tried to replicate this problem on my own test site with the same plugin installed, to see if this is a replicable compatibility issue. The same problem occurs when making changes in a Field Group that includes RFGs, the RFG group slug and the slugs of any nested RFGs also changes to include a new number suffix like -2.

That's enough for my 2nd tier team to investigate. Let me escalate this issue for them to take a closer look and see if there's anything we need to do on our end to resolve this problem, or if the issue must be resolved in the Church Content plugin. I'll let you know what I find out as soon as I can.

#2133943

That's great, thank you very much for your help. I think I only use that plugin for events, so I can recreate what that does in Toolset and delete it.

Much appreciated!

#2134827

Okay great, it sounds like a decent workaround. Another possibility is that you temporarily disable the plugin any time you need to make changes in a Field Group that contains an RFG. That might require less work on your part. Regardless, our team is investigating the compatibility issue and I'll continue to update you here through the ticket replies. Feel free to resolve here if that works for you.

#2140505

I have some additional feedback from my 2nd tier support team, who performed additional analysis and found a code filter-based workaround.

...When saving the Field Group, the RFG post is updated, triggering the usual filters and actions that run when using wp_insert_post(). The problem occurs when WordPress checks if the current slug is a sensible slug, specifically in wp-includes/post.php:4877 it checks whether the slug would be "bad as a flat slug":

		$is_bad_flat_slug = apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type );

Without the Church Content plugin, this always returns false, there is nothing wrong with the RFG slug. But the plugin introduces its own logic to determine if there is a problem with the slug, in church-theme-content/includes/admin/admin-posts.php with a function ctc_is_bad_post_slug which is a callback added to the above wp_unique_post_slug_is_bad_flat_slug filter, and returns true. Because it returns true, WordPress appends the suffix _2 everytime the field group is saved."
Feel free to share this feedback with the Church Content plugin authors.

For a workaround that does not require disabling either plugin during editing, you can filter the offending method with a higher priority and return false, e.g.:

add_filter( 'wp_unique_post_slug_is_bad_flat_slug', '__return_false', 11 );
#2141257

Great, thank you for all your help.

#2141435

You're welcome, feel free to start new tickets if you run into additional problems.