fix: Bypass headless home URL for specific cases
This commit is contained in:
@@ -16,3 +16,17 @@ function moonshine_after_setup_theme() {
|
|||||||
|
|
||||||
// Register sidebars
|
// Register sidebars
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bypass headless home URL for specific cases
|
||||||
|
add_filter( 'home_url', 'moonshine_bypass_home_url', 10, 4 );
|
||||||
|
function moonshine_bypass_home_url( $url, $path, $orig_scheme, $blog_id ) {
|
||||||
|
$excluded_patterns = array(
|
||||||
|
'#/wp-json(/|$)#i',
|
||||||
|
);
|
||||||
|
foreach ( $excluded_patterns as $pattern ) {
|
||||||
|
if ( preg_match( $pattern, $url ) ) {
|
||||||
|
return get_site_url( $blog_id, $path, $orig_scheme );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user