Skip to content

Commit 4a308b0

Browse files
authored
Merge pull request #201 from andrewlimaza/fix-permalinks
Fix subdomains/subdirectory profile pages
2 parents 52e884c + c8de79a commit 4a308b0

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

includes/functions.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,15 @@ function pmpromd_custom_rewrite_rules() {
222222
return;
223223
}
224224

225-
$structure = get_option( 'permalink_structure' );
226-
if ( empty( $structure ) ) {
227-
return;
228-
}
229-
230225
// Get the profile permalink.
231226
$profile_permalink = get_permalink( $pmpro_pages['profile'] );
232227

233228
// Parse the path from the permalink, taking subfolder installations into account.
234-
$profile_base = trim( parse_url( $profile_permalink, PHP_URL_PATH ), '/' );
229+
$profile_page = get_post( $pmpro_pages['profile'] );
230+
if ( ! is_object( $profile_page ) || empty( $profile_page->post_name ) ) {
231+
return;
232+
}
233+
$profile_base = $profile_page->post_name;
235234

236235
// Add the rewrite rule.
237236
add_rewrite_rule(

0 commit comments

Comments
 (0)