Home Forums Front-end Issues Custom fiels not shown/updated in existent pages


Custom fiels not shown/updated in existent pages

  • Hi,
    I’m using a custom field called “video” for getting and showing a Youtube ID on a WP page.
    I I create a new page, the custom field works without problems.

    When I try to edit the “Video” custom field on an already existent page, the custom field will be updated in the backoffice but not shown in the frontend!!
    After I save the changes, the “video” field shows the new ID but in the Frontend i have NOTHING!!!
    I also checked in the database, and the custom field is populated.

    So, why I have no output in the page?
    I’m using this code:

    tried also with

    and still nothing

  • Hi @lextar

    If you can confirm that the value does change on the backend, then the value is correctly saving / loading to the DB.

    The issue could be related to caching perhaps?
    Also, where are you using the the_field code? In a single.php file?
    Are you using it within a loop?


  • Hi elliot,

    Yes, I confirm that the value does change in the backend and also saved to DB (checked using phpmyadmin)

    What type of cache do you mean? If you mean the browser cache I cleared it and tried on different browsers/machines.

    I’m using the code on a custom page.php outside the loop.

  • Hi @lextar

    The cache I am referring to is page / database cache which would require a Cache plugin to work.

    If your code is outside the loop, it is possible that ACF deos not understand which post to load the data from.

    Can you move the code within the loop to test this?


  • Hi elliot,
    I’m not using any caching plugin an the moment.
    In my single.php page I don’t have the loop code. It is just a simple page that prints out all the ACF fields without the WP default content

  • Hi @lextar

    It is possible that you have a plugin / theme code which is modifying the post_id which ACF uses to load the value from.

    Can you debug the global $post object?

    global $post; 
    echo '<pre>';
    echo '</pre>';

    Place the above code in your single PHP file. Does the $post object contain the correct ID and title?


  • Hi Elliot,

    Yes, I get the correct ID and title.
    I tried to duplicate the page and it works (I edited the CF several times without problems) but the original pages are still not working.

  • I found the problem:
    This happens only if the page has subpages! The subpages also have the same “video” custom field.

    If the page does’t have any subpage, the video shows up.
    I resolved the problem by putting this code after the loop that shows up a list of subpages:

    <?php wp_reset_postdata(); ?>
    <?php wp_reset_query(); ?>

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Custom fiels not shown/updated in existent pages’ is closed to new replies.