Skip to content

Commit f838634

Browse files
committed
fix: improve Faust preview rewrite handling
1 parent 1775f2d commit f838634

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

plugins/hwp-previews/src/Integration/Faust_Integration.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,22 @@ public function is_faust_rewrites_enabled(): bool {
198198
* @param string $url The URL to be rewritten.
199199
*/
200200
public function replace_faust_preview_rewrite($url): string {
201-
if ( function_exists( '\WPE\FaustWP\Settings\faustwp_get_setting' ) ) {
202-
$frontend_uri = \WPE\FaustWP\Settings\faustwp_get_setting( 'frontend_uri' );
201+
if ( ! function_exists( '\WPE\FaustWP\Settings\faustwp_get_setting' ) ) {
202+
return $url;
203+
}
203204

204-
// Return the URL as is if frontend uri is empty.
205-
if ( ! $frontend_uri ) {
206-
return $url;
207-
}
205+
$frontend_uri = \WPE\FaustWP\Settings\faustwp_get_setting( 'frontend_uri' );
208206

209-
$frontend_uri = trailingslashit( $frontend_uri );
210-
$home_url = trailingslashit( get_home_url() );
207+
// Return the URL as is if frontend uri is empty.
208+
if ( ! $frontend_uri ) {
209+
return $url;
210+
}
211211

212+
$frontend_uri = trailingslashit( $frontend_uri );
213+
$home_url = trailingslashit( get_home_url() );
212214

213-
return str_replace( $frontend_uri, $home_url, $url );
214-
}
215215

216-
return $url;
216+
return str_replace( $frontend_uri, $home_url, $url );
217217
}
218218

219219
/**

0 commit comments

Comments
 (0)