WP カスタムフィールドを別のページで使う

固定ページのIDを取得し、the_fieldで指定する

<?php
$page = get_page_by_path('recruit'); //ページスラッグ
$page_id = $page->ID;
?>
<?php the_field('recruit_message_title', $page_id); ?>
<?php the_field('recruit_message_txt', $page_id); ?>

フロントページの場合

<?php
$front_page_id = get_option('page_on_front');
?>
<?php the_field('philosophy', $front_page_id); ?>

posipan.com