Support

Account

Home Forums Add-ons Options Page get_field returns null when logged out

Solved

get_field returns null when logged out

  • Hello,

    I’ve ran into a really strange issue that I’ve spent a while poking around trying to find a solution.

    I am using an ACF repeater, on an options page to create a visual interface for adding custom image sizes to a WP site. Its all setup and works brillaintsly, however when I am not logged into WordPress the call to:

    get_field('custom_image_sizes', 'options');

    returns null instead of the array that it should.

    Has anyone else ran into this kind of thing before? Could it be because I’ve exported by ACF field groups and am including them as PHP files?

  • Hi @shaunbent

    The logged in status should not be effecting ACF loading the field…

    Perhaps you have included your code in a condition that the user is logged in?

    Perhaps there are some PHP errors when not logged in?

    Perhaps the page is cached when not logged in?

  • Hi @elliot,

    Sorry I forgot to get back to you about this, had one of those busy days.

    I managed to get to the bottom of it, I had my included PHP files wrapped in an if user logged in.

    Sorry

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

The topic ‘get_field returns null when logged out’ is closed to new replies.