php - ACF Content Not Showing

I have created ACF Fields for Wordpress User page Text and image When I try to display on single.php its not showing nither image or text is showing below is screenshot for refrence.

https://prnt.sc/ezFU-JPZH3Rs

 <ul class="list-unstyled">
                            <li>
                                <div class="row">
                                    <div class="col-4">
                                        <div class="home-blog-author">
                                            <?php
                                             $avatar_image= get_field('user_image', 'user_'. $author_id );
                                            ?>
                                            <picture>
                                                <img src="<?php echo $avatar_image['url']; ?>" class="img-fluid" alt="<?php echo $avatar_image['alt']; ?>">
                                            </picture>
                                        </div>
                                    </div>
                                    <div class="col-8 align-self-center ps-0">
                                        <div class="home-author-name">
                                            <h5><?php //echo the_field('user_name', 'user_' .$author_id); ?></h5>
                                        </div>
                                    </div>
                                </div>
                            </li>
                            <li>
                                <i class="fas fa-calendar-alt"></i>
                                <span><?php echo get_the_date('d/m/Y'); ?></span>
                            </li>
                        </ul>

Answer

Solution:

You know that in your snippet you have the name text commented out, right? Otherwise you have multiple possible failure points. Off the top of my head:

  1. Are you sure you're retuning the html as expected (with or without the ACF data)? If not, then you may have the wrong template or other problems. If so:
  2. Are you sure you have the ACF user_image field set to return an array - and in particular for the user you're testing?
  3. Have you tried returning the ACF field by key rather than field name? That sometimes helps.

Source