I’m using the wpForo plugin to create custom profile pages on the front end of my website.
The profile URLs generated by the wpForo plugin look like this:
example.com/community/profile/username/
example.com/community/account/username/
I managed to rewrite these URLs internally by editing some of the core plugin files. (Yes, I know, very dirty.) Now these urls looks like this, but they obviously lead to non-existing pages, showing a 404 error.
example.com/user/username/
example.com/user/username/account/
Can I use WordPress’s rewrite rules to basically display the wpForo profile page on the edited URLs? I tried the following, but it doesn’t work.
function custom_wpforo_rewrite_urls() {
// Regex returns these matches
/*
0 = community/profile/username/
1 = profile
2 = username
*/
add_rewrite_rule('/community\/(.*)\/(.*)\//', 'user/$matches[2]/$matches[1]', 'top');
} add_action('init', 'custom_wpforo_rewrite_urls');
Which should result in the following URLs working… But they don’t.
example.com/user/username/profile/
example.com/user/username/account/