Re: [解決済み] サブディレクトリでのパーマリンクの出力について

フォーラム 使い方全般 [解決済み] サブディレクトリでのパーマリンクの出力について Re: [解決済み] サブディレクトリでのパーマリンクの出力について

#63580
kyokyo
参加者

原因がわかりましたので報告させていただきます。

運営サイトをhttps://で表示した際に、ウィジェットなどのリンクURLがhttps://にならなかったので、function.phpに下記の記述をしておりました。

これにより、すべてのURLを相対URLにしています。


class relative_URI {

function relative_URI() {

add_action(‘get_header’, array(&$this, ‘get_header’), 1);

add_action(‘wp_footer’, array(&$this, ‘wp_footer’), 99999);

}

function replace_relative_URI($content) {

$home_url = trailingslashit(get_home_url(‘/’));

return str_replace($home_url, ‘/’, $content);

}

function get_header(){

ob_start(array(&$this, ‘replace_relative_URI’));

}

function wp_footer(){

ob_end_flush();

}

}

new relative_URI();


8行目の

return str_replace($home_url, ‘/’, $content);

return str_replace($home_url, ‘/sub/’, $content);

とすることで解決しました。