Home Forums Front-end Issues Field not displaying on front end (complicated setup).


Field not displaying on front end (complicated setup).

  • Ok, we are using ACF to power a database of sites, using repeaters, etc, and haven’t had a single problem, except for a new field that just doesn’t seem to want to work properly.

    Our site is a networked blog of about 10 sites all living on subdomains, the effected site lives on a sub domain, but is being redirected to using some htaccess magic (this may be related, but i’m not sure). We have one field which adds a label to a button. Here are the effected urls.


    URL 1 is the ‘live’ url, everything working fine EXCEPT the button in the slider at the top right of the site under the text, you can se there is no visible word there:

    URL 2 isn’t actually the live url, but is the source url for #1 (which is being masked using htaccess). URL2 works as it should, you’ll notice the button displays “Voir”.

    For some reason I can’t seem to figure out why the url masking would effect JUST THAT ONE FIELD. The code is very vanilla. I get the variable, and display it (just like I have for the 20 other fields on this page):

    <?php $slide_button_text = $slide['slide_button_text'];?>
    <p><a href="<?php echo $ext_int_link; ?>" class="btn btn-info btn-large"><?php echo $slide_button_text; ?></a></p>

    Any help, or insight as to what may be happening here would be greatly appreciated.

  • Out of curiosity, have you checked your error logs recently? Sometimes there’s treasure in there.

    That’s a pretty strange bug! The first thing that pops to mind is that the post loop is using a global $post variable that you’re not expecting, but that is obviously not the case – the rest of the slide info seems to be showing!

    Can we assume that $slide = get_field('slider', $post->ID); or something similar? And are you using two different sets of code, or is the PHP/MySQL just being served to 2 different URLs?

  • Haven’t checked the error logs, but will look into that – thats a good suggestion.

    – Yeah the rest of the info is displaying just fine…

    The slides are being called (shortened):

    $slider = get_field('slider');
    foreach($slider as $slide) :
    	$slide_button_text = $slide['slide_button_text'];

    etc etc….

    Same set of code for both links as well, it’s just masking the sub folder…

    This site is using the WPMU plugin as well.
    The only other thing I can think of is that we had added this “slide button text” field much later in development. Don’t know if that would be the cause..

    Here are some links where it’s WORKING – so for some reason it’s just effecting that one post…

  • It would be interesting to see if the data is actually being loaded into the slide object.

    Debug! Commented / hidden dump:

    <?php echo 'ID: '.$post->ID.'<!-- '.print_r($slider, true).' -->'; ?>

    … or wide-open visibility:

    <?php echo '<pre>ID: '.$post->ID.' - '.print_r($slider, true).'</pre>'; ?>

    2 uses here: confirm that $post->ID is the one that we need, and dump all of the $slider data into a visible array. is [slide_button_text] being populated where it should?

    Troubleshooting suggestions from the bottom up I guess. Oh, and place those after you load the $slider object, obviously 😀

  • I unfortunately don’t have direct access to the files (security) so I can’t easily run tests like that. And I haven’t been able to reproduce it on a staging server, and another development server.

    I understand that this makes it even more difficult…

  • Hah, yes that is always challenging.

    Ah, you say you added that particular field later in development… was that before or after the WPMU setup? I wonder if the databases aren’t exactly the same.

  • It would have been AFTER the WPMU setup was done – if the other fields (there are about 20 on that page template – including ones using the repeater plugin)

  • Well then… do you have access to the databases? I’m not terribly familiar with MU setup, but I do seem to recall that the original database gets cloned and set up for each new site.

    I’m checking out a test install of MU right now, but maybe you can answer faster – are the same custom fields available across all of the MU sites in the admin section, and is it possible to set up a new field in one MU site and not have it visible in a different site? If yes, it might be a good idea to check all of the MU sites and make sure that they all have the same fields… and then go and re-save/update the sliders and their text values.

  • Hi again @flashpunk! I dug into my local MU setup and confirmed how ACF operates across MU sites.

    The attached screenshot details a 4-site MU setup, and the primary site has a single post with a single text ACF with the contents “derp” in it. As we can see from the database queries on the right, the string was only found in the primary MU install site and not the others… so I guess this confirms the idea that ACF data is independent across MU sites.

    You’ve undoubtedly already checked this out, but can we confirm that the missing slider button text actually exists from the admin? Have you tried deleting that particular ACF field and re-creating it and adding the text again?

    Debugging without code/db access is indeed a bit harder 🙂

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

The topic ‘Field not displaying on front end (complicated setup).’ is closed to new replies.