Skip to content

Commit 77ee7f7

Browse files
authored
fix: Fix a bug with environments where site_url() is different to home_url() (#9)
1 parent 54a1a0c commit 77ee7f7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Post_Type_Page.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ public function update_archive_slug( $args, $post_type ) {
9595
$link = get_permalink( $this->post_id );
9696

9797
/**
98-
* We need to strip away the current base URL from the link, so that we get the relative
99-
* link. It’s not enough to use wp_make_link_relative(), because then WordPress websites in
100-
* subfolders wouldn’t work. This is often the case in multisite environments.
98+
* We need to strip away the current base URL from the link, so that we
99+
* get the relative link. It’s not enough to use wp_make_link_relative(),
100+
* because then WordPress websites in subfolders wouldn’t work. This is
101+
* often the case in multisite environments.
101102
*/
102-
$link = str_replace( site_url(), '', $link );
103+
$link = str_replace( home_url(), '', $link );
103104

104105
// Trim leading and trailing slashes.
105106
$link = trim( $link, '/' );

0 commit comments

Comments
 (0)