Home Forums Front-end Issues get_field() return null on live server, but on development server works fine


get_field() return null on live server, but on development server works fine

    • icen

    • October 10, 2020 at 4:30 am


    I spent whole day trying to solve this…

    I have development server, and ACF works without any problem.

    When I migrated site to a new live server, ACF values are not showing on frontend of website.

    Tried everything I can, like:

    ini_set('display_errors', 1); // just to have
    echo get_the_ID();
    global $post;
    echo '<hr>';
    echo get_field('zvanje');
    echo '<hr>';
    echo '<hr>';
    echo '<hr>';
    echo ($iceCustomFields['zvanje']);
    echo '<hr>';
    echo get_field('zvanje', get_the_ID());
    echo '<hr>';
    echo '<hr>';

    … but all of that returns nothing (empty), except last two that returns:


    Also, next two lines are returing NULL:


    My custom fields are “zvanje” and “titula” (and few more, but this is just an example).

    I was thinking, are there some PHP requirements I missing on new server? Or is it something with PHP version (but I tried 7.1, 7.2, 7.3 and 7.4).

    Please if you can help. Don’t know how to solve this anymore…

    • icen

    • October 10, 2020 at 4:32 am

    Forget to add at the beginning of my code example:

    $iceCustomFields = get_fields();

    Sorry and thank you!

  • How did you move the content from the dev to live servers?

    What types of fields are not showing content?

    • icen

    • October 10, 2020 at 6:39 pm

    Migration – as usual – export db into file, change all occurrences of old domain to new one. Everything else works fine without problem. I have lot’s of experience in WP.

    It’s not the first time I’m doing this, that’s also why I’m bit confused.

    Two years ago I migrated the same WP instance from same development server, to almost same live server. Difference between those two live servers is in MySQL – on first (where it works, installation two years ago) is 5.6.49 and on second (where I have a problem) is 5.0.12.

    But, all in all, it looks like those ACF variables are not “registered” or something like that… looks like they are not “visible” or accessible on front end. Can I help myself by adding something in functions.php file or something like that?

    Thank you in advance!

  • I don’t know what the problem is yet. That’s why I asked what kind of fields are not showing the correct values. Is it all fields or just some fields?

    For example, a link field stores a serialized array. Altering the value of the link in a text file and then importing that into the DB will likely break that field. Serialized values need special handling. I generally import the db directly and then use this tool to make updates

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.