3 deleted 162 characters in body
source | link

I've followed several related solution. But I'm still facing the problem. I've applied the following code for my custom post query by taxonomy (category). But it's not working. I think my problem with 'terms'.

            $terms = get_terms('service_cat');
            $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'tax_query' => array(
                    array(
                        'taxonomy' => 'service_cat',
                        'field' => 'cat1',
                        'terms' => $terms
                    )
                ),
            ));

I also tried by the following code

    $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'category_name'     => 'cat1' 
    ))

I've followed several related solution. But I'm still facing the problem. I've applied the following code for my custom post query by taxonomy (category). But it's not working. I think my problem with 'terms'.

            $terms = get_terms('service_cat');
            $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'tax_query' => array(
                    array(
                        'taxonomy' => 'service_cat',
                        'field' => 'cat1',
                        'terms' => $terms
                    )
                ),
            ));

I also tried by the following code

    $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'category_name'     => 'cat1' 
    ))

I've followed several related solution. But I'm still facing the problem. I've applied the following code for my custom post query by taxonomy (category). But it's not working. I think my problem with 'terms'.

$terms = get_terms('service_cat');
$services_post = new WP_Query(array(
    'post_type'         => 'service',
    'posts_per_page'    => -1,
    'tax_query' => array(
        array(
            'taxonomy' => 'service_cat',
            'field' => 'cat1',
            'terms' => $terms
        )
    ),
));

I also tried by the following code

$services_post = new WP_Query(array(
            'post_type'         => 'service',
            'posts_per_page'    => -1,
            'category_name'     => 'cat1' 
))
2 deleted 7 characters in body
source | link

I've followed several related solution. But I'm still facing the problem. I've applied the following code for my custom post query by taxonomy (category). But it's not working. I think my problem with 'terms'.

            $terms = get_terms('service_cat');
            $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'tax_query' => array(
                    array(
                        'taxonomy' => 'service_cat',
                        'field' => 'cat1',
                        'terms' => array($terms)
                    )
                ),
            ));

I also tried by the following code

    $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'category_name'     => 'cat1' 
    ))

I've followed several related solution. But I'm still facing the problem. I've applied the following code for my custom post query by taxonomy (category). But it's not working. I think my problem with 'terms'.

            $terms = get_terms('service_cat');
            $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'tax_query' => array(
                    array(
                        'taxonomy' => 'service_cat',
                        'field' => 'cat1',
                        'terms' => array($terms)
                    )
                ),
            ));

I also tried by the following code

    $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'category_name'     => 'cat1' 
    ))

I've followed several related solution. But I'm still facing the problem. I've applied the following code for my custom post query by taxonomy (category). But it's not working. I think my problem with 'terms'.

            $terms = get_terms('service_cat');
            $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'tax_query' => array(
                    array(
                        'taxonomy' => 'service_cat',
                        'field' => 'cat1',
                        'terms' => $terms
                    )
                ),
            ));

I also tried by the following code

    $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'category_name'     => 'cat1' 
    ))
1
source | link

Query custom post type by custom taxonomy (category slug)

I've followed several related solution. But I'm still facing the problem. I've applied the following code for my custom post query by taxonomy (category). But it's not working. I think my problem with 'terms'.

            $terms = get_terms('service_cat');
            $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'tax_query' => array(
                    array(
                        'taxonomy' => 'service_cat',
                        'field' => 'cat1',
                        'terms' => array($terms)
                    )
                ),
            ));

I also tried by the following code

    $services_post = new WP_Query(array(
                'post_type'         => 'service',
                'posts_per_page'    => -1,
                'category_name'     => 'cat1' 
    ))