This past weekend while managing a site that runs BuddyPress, I ran into a situation where I needed to change a group’s slug or permalink. Editing the permalink for a post or page in WordPress is easy but BuddyPress doesn’t have the same functionality. As you can see in the screenshot below, an edit button to change a group’s permalink doesn’t exist.
Changing the permalink of a post in WordPress automatically creates a redirect so the previous URL doesn’t generate a 404 error. BuddyPress doesn’t offer the same convenience. According to John James Jacoby, BuddyPress lead developer, groups do not have a canonical redirection, or keep track of their slug history.
In my scenario, I had two choices. I could either change the slug and break a number of links or delete the group and recreate it with the slug of my choice. Since the group already has more than 300 members and a handful of posts, I chose the first option.
After a cursory search of Google on how to change a group’s slug, I came across many results that referenced the BP Edit Group Slug plugin created by Jacoby that had not been updated in seven years. As recently as two months ago, a thread on the BuddyPress support forums confirmed that the plugin was broken and generated a lot of errors.
After speaking to Jacoby on Slack and linking him to the forum thread, he graciously spent two hours of his time to update the plugin. I can confirm that it works as advertised with BuddyPress 2.8.1. To change a group’s slug after activation the plugin, visit the Group’s management page on the front-end of the site.
Eight years ago, a ticket was created on BuddyPress trac requesting the ability to change a Group’s slug. The ticket was eventually closed and labeled wontfix by Boone Gorges, BuddyPress lead developer, “Adding it as a core feature is likely to introduce lots of problems, because changed group slugs break all existing links to the content,” Gorges said. “We don’t have a graceful fallback system for changed permalinks, like WP posts do. For now, let’s leave this to a plugin. If we ever overhaul groups to have a different storage mechanism, we can revisit.”
In the BuddyPress Slack channel, David Cavins offered the following idea on how the feature could work, “We could probably add a step after the lookup fails that looks in another place, like group_meta
for key = previous_slug
and value = slug that missed a group
,” he said. Both Gorges and Jacoby approved the idea and encouraged Cavins to work on it for BuddyPress core.
Until the feature is added to core, perhaps a note could be added to the BuddyPress group creation screen for step three that emphasizes how important it is to make sure the permalink is correct.
I was willing to sacrifice broken links in order to have the correct slug for my Group but it’s a lesson I learned the hard way. I’m hopeful that others don’t make the same mistake and that BuddyPress one day has a graceful fallback system for tracking permalink changes.
Might be able to build a tool into tools menu to edit all strings to fix the link