Home > other >  I can't debug whats wrong with my ACF get_field() to display an image array's url value
I can't debug whats wrong with my ACF get_field() to display an image array's url value

Time:02-05

So my code is pretty straightforward. I am just getting a field value from the global fields (Options). So this field is on Dashboard -> Options (I have ACFpro) and I am trying to echo out a logo which is an image array.

This is how my code looks like

                <ul >
                    <a  href="/">
                        <?php
                           $image = get_field('logo');
                           echo '<p id="debug">'.($image ['url']).'</p>';
                        ?>
                    </a>
                </ul>

al i am trying to do is pull the url value and insert it to a <p> tag just to make sure it pulls the right value. but instead I am getting this error.

enter image description here

I would change it to

get_field( 'logo', 'options' );

Or change options to whatever you called your options page.

https://www.advancedcustomfields.com/add-ons/options-page/

  •  Tags:  
  • Related