'the_field(); custom field not showing anything

i want my font-awesome set in the custom field but when i want to use the_field();

it does not show me the value or i get error

        <?php
            $args = array (
                'post_type' => 'content',
                'post_status' => 'publish',
                'posts_per_page' => 3,
                'order' => 'ASC',
                'category_name' => 'header'
            );
            $query = new WP_Query($args);
            remove_filter( 'the_excerpt', 'wpautop' );
            remove_filter( 'the_content', 'wpautop' );
            if ( $query -> have_posts() ):
                while ( $query -> have_posts() ):
                    $query -> the_post();
        ?>
        <div>
            <i class="<?php the_field( 'icon' ); ?>"></i>
            <ul class="grid rowgap-1">
                <li><strong><?php the_title(); ?></strong></li>
                <li><?php the_content(); ?></li>
            </ul>
        </div>
        <?php
                endwhile;
            endif;
            wp_reset_query();
    ?>

please help me....



Solution 1:[1]

did you changed name 'icon' for custom field? if did, you must add icon image again

or used get_field for test

or add echo behind these

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mohsen sami