I’m having trouble with Advanced Custom Fields in WordPress. I set up some custom fields and added content to them in the admin panel, but they won’t show up on my homepage.
Here’s the code I’m using to display the field:
<div class="header-section bold green-text">
<?php the_field('main_page_title'); ?>Latest Updates
</div>
I’ve double checked that the field name matches exactly what I created in ACF. The static text shows up fine, but the dynamic content from the custom field is completely blank. I tried creating a brand new field with a different name to make sure there weren’t any conflicts with existing field groups, but I’m getting the same result. Has anyone else run into this issue before? I’m wondering if there’s something I’m missing in the setup or if this might be a plugin conflict.
maybe your homepage isn’t set to the right page? acf fields link to specific ones, so if your homepage is displaying the latest posts it won’t show the custom fields. check Settings > Reading to make sure your homepage is set to the right static page.
Had this exact problem six months ago - turned out to be a page ID mismatch. WordPress assigns different IDs to your homepage depending on setup, and ACF gets confused about which page to pull data from. Add the page ID parameter to your function: <?php the_field('main_page_title', get_option('page_on_front')); ?>. This forces ACF to grab the field from your actual front page instead of guessing. Check the correct page ID by editing your homepage in admin - the number after ‘post=’ in the URL is what you need. Test this first before getting into complex troubleshooting.
Classic ACF location rules issue. Your field group isn’t targeting the right page type. Check your field group settings - the location rules at the bottom need to say ‘Page Type equals Front Page’ or target your homepage template specifically. I ran into this exact problem last year. My fields were only showing on regular pages, not the front page. Also double-check you’re using get_field() instead of the_field() - the context can matter depending on where you call it in your template.