Custom Tag Description unable to display just below and outside of the Loop

Hello StackExchange Team! In my wordpress tags for custom post type, the code ?php echo term_description();? or outputs fine just outside and above the loop.

The problem I am having is that the same tag_description is blank when placed outside and below the loop below.

?php
                            $countries_location = '';
                            $countries_location = apply_filters('zeetume_site_location_ads', $countries_location, 'search');
                            if (get_query_var('paged')) {
                                $paged = get_query_var('paged');
                            } else if (get_query_var('page')) {
                                // This will occur if on front page. 
                                $paged = get_query_var('page');
                            } else {
                                $paged = 1;
                            }
                            $category = array(
                                array(
                                    'taxonomy' = 'ad_tags',
                                    'field' = 'term_id',
                                    'terms' = get_queried_object_id(),
                                ),
                            );
                            
                            $ad_tags_args = array(
                                'post_type' = 'ad_post',
                                'post_status' = 'publish',
                                'posts_per_page' = get_option('posts_per_page'),
                                'tax_query' = array(
                                    $category,
                                    $countries_location,
                                ),
                                'meta_query' = array(
                                    array(
                                        'key' = '_zeetume_ad_status_',
                                        'value' = 'active',
                                        'compare' = '=',
                                    ),
                                ),
                                'orderby' = 'date',
                                'order' = 'DESC',
                                'fields' = 'ids',
                                'paged' = $paged,
                            );
                            
                            $ad_tags_query = new WP_Query($ad_tags_args);
                            
                            if ($ad_tags_query-have_posts()) {
                            ?
                            div class=clearfix/div
                            div class=posts-masonry
                                div class=col-md-12 col-xs-12 col-sm-12
                                    ul class=list-unstyled
                                        ?php
                                while ($ad_tags_query-have_posts()) {
                                    $ad_tags_query-the_post();
                                    $pid = get_the_ID();
                                    $ad = new ads();
                                    echo zeetume_returnEcho($ad-zeetume_search_tag_list_layout($pid));
                                }
                                        ?
                                    /ul
                                /div
                            /div
                            div class=clearfix/div
                            div class=col-md-12 col-xs-12 col-sm-12
                                ?php zeetume_pagination($ad_tags_query);?
                            /div
                            ?php
                            } else {
                                get_template_part('template-parts/content', 'none');
                            }
                            wp_reset_postdata();
                            ? 

Please help me out, I am confused as to what the problem is.

Topic description loop tags php custom-post-types Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.