searchform.php не отображается на сайте

Есть форма в файле searchform.php стандартная, которая должна выводиться через get_search_form. Пытался подключить файл, где форма через get_template_part(), но она отображается только зарегистрированным пользователям. Как мне решить эту проблему? Форма вызывается в functions.php, а оттуда идет в шорткод add_shortcode('search_bar' , 'search_bar') и выводится на front-page.php.

 function search_bar() {
    ob_start();
        $ar = array(
            'post_type' => 'site_contents',
            'post__in' => array(2764)
        );
        $qq = new WP_Query($ar);
        while( $qq->have_posts() ) { $qq -> the_post();
        $detect = new Mobile_Detect;
    if( !$detect -> isMobile() ) { ?>

    <section class='search_bar p-relative bg-c-2'>
        <div class='box-left p-absolute'></div>
        <section class='wrapper'>
            <div class='container'>
                <div class='row'>
                    <div class='col-lg-3 col-md-12 col-sm-12'>
                        <div class='decor'>
                            <span class='fs-24 f-b p-relative fc-6'>  <?php the_content(); ?> </span>
                        </div>
                    </div>
                    <div class='col-lg-9 col-md-12 col-sm-12 '>
                        <?php
                                    get_template_part('searchform'); 
//                       get_search_form(  );
                        ?>
                    </div>
                </div>
            </div>
        </section>
        <div class='box-right '> </div>
    </section>
    <?php } else { ?>

<section class='search_bar p-relative bg-c-2'>
        <div class='box-left p-absolute'></div>
        <section class='wrapper'>
            <div class='container'>
                <div class='row'>
                        <div class='decor'>
                            <span class='fs-24 f-b p-relative fc-6'>  <?php the_content(); ?> </span>
                        </div>
                    <div class='col-lg-9 col-md-12 col-sm-12 '>
                        
                        <?php 
              get_template_part('searchform'); 
//                get_search_form(); 
                        ?>
                    </div>
                </div>
            </div>
        </section>
        <div class='box-right '> </div>
    </section>

    <?php
    }
    } wp_reset_postdata();
    return ob_get_clean();
}
add_shortcode('search_bar' , 'search_bar');

Ответы (0 шт):