WordPress個別ページ画像相対パス
WordPress個別ページの画像を相対パスに変更。
下記コードを「functions.php」に記述。
「functions.php」
function replaceImagePath($arg) { $content = str_replace('"images/', '"' . get_bloginfo('template_directory') . '/images/', $arg); return $content; } add_action('the_content', 'replaceImagePath');
HTML
<img src="images/logo.gif">