Skip Navigation

[Resolved] Toolset Conflict with Custom Permalinks Plugin

This support ticket is created 4 years, 5 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)

Author
Posts
#1361977
example.png

Hi,

I am trying to implement toolset in my website which has custom permalinks plugin (CP) installed already -> https://wordpress.org/plugins/custom-permalinks/

Most of the URL structure present in the site have been manually curated using CP plugin and the site has around 2000 posts so there is no way for me to avoid using it (as I will never want my post URLs to change).

Here is the problem:

When I try to create a post with repeatable field using toolset, the CP plugin assigns the post permalink as the slug of the custom post types which are created using toolset.

Let me elaborate this in detail:

Like I created a post with URL -> india/places-to-view-in-india

and in this post, I created three elements like -> Rajasthan, Punjab, Haryana via repeatable field

so now if I check in custom permalinks it showing URL like this

Real post URL -> india/places-to-view-in-india
Rajasthan -> india/places-to-view-in-india
Punjab -> india/places-to-view-in-india
Haryana -> india/places-to-view-in-india

Due to this, the post redirects automatically to the homepage.

Please help me to solve this issue as it’s really important for me.

#1362225

Hi, I'll be glad to help. I ran a quick test with this plugin, and I can see what you are describing. Each RFG row is assigned a custom permalink when you assign a custom permalink to the main post. I did a quick search through the plugin information and found some custom code that you can use to solve this problem.

First, please delete the custom permalinks for Rajasthan, Punjab, Haryana, and any other RFGs shown in the Custom Permalinks list. After that, you can add this code to a custom code snippet in Toolset > Settings > Custom Code, or in a child theme's functions.php file:

// prevent custom permalinks assigned to RFGs in post editor screen
function yasglobal_exclude_post_types( $post_type ) {
  $rfg_array = ['places-details-newly'];
  if ( in_array( $post_type, $rfg_array ) ) {
    return '__true';
  }
  return '__false';
}
add_filter( 'custom_permalinks_exclude_post_type', 'yasglobal_exclude_post_types');

This will prevent the plugin from creating permalinks for the "places-details-newly" RFG. If you have other RFGs in other custom post types using custom permalinks, you should add that RFG slug to the $rfg_array on line 2, using a comma-separated list:

$rfg_array = ['places-details-newly','another-rfg-slug','third-rfg-slug','more-rfg-slugs'];

Let me know if you have questions about this PHP solution.

#1362349

Hello,

I tried as you said but when i am saving the post, its again creating permalinks in custom permalink that i deleted. And now its giving 404 error (not redirecting).

I also tried by deleting custom permalink, post completely, and created a new post with same post url (permalink), still its giving 404 error.

#1362761

May I log in and see how you added the custom code snippet? Please provide login credentials in the private reply fields here and I will give you some feedback.

#1363541

I see, it seems the solution worked on my site because I didn't understand the problem fully. Let me escalate this to my 2nd tier support team for further investigation, as it appears to be a compatibility issue with the Custom Permalinks plugin. I'll let you know what I find out.

#1559397

What is the resolution to this issue?

#2112345

Hello, I apologize for the lack of response here. Somehow this ticket slipped out of my queue and fell off my radar. I'd like to resolve the issue if possible. I tried to reproduce the problem in the latest versions of Toolset and Custom Permalinks (1.7.1) but I was unable to see the same problem. I created a custom post type, added a post, gave it a custom permalink with a completely different slug and title, and added a couple of RFG entries in the post's custom fields. Even though the permalinks for the main post and its RFGs are identical in the Custom Permalinks dashboard, the main post is displayed correctly when I visit the main post URL. I do not see any error messages, and there is no obvious redirect in the browser. I tested with posts created in the Block Editor as well as posts created in the Classic Editor. I tested posts with and without Toolset Content Templates applied. I just couldn't reproduce the problem where the homepage is displayed instead of the main post. Maybe there is a configuration difference between our sites, or something I cannot recall from the beginning of this ticket. Please take a look and let me know - can you replicate the problem in the current versions of the plugins with the latest version of WordPress active?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.