Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link.

Example

$args = array(
    'post_type' => 'team',
    'tax_query' => array(
        array(
            'taxonomy' => 'team_categories',
            'field'    => 'slug',
            'terms'    => 'SLUG FOR PARTICULAR TERM',
        ),
    ),
);
$query = new WP_Query( $args );

This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer hereanswer here

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link.

Example

$args = array(
    'post_type' => 'team',
    'tax_query' => array(
        array(
            'taxonomy' => 'team_categories',
            'field'    => 'slug',
            'terms'    => 'SLUG FOR PARTICULAR TERM',
        ),
    ),
);
$query = new WP_Query( $args );

This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer here

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link.

Example

$args = array(
    'post_type' => 'team',
    'tax_query' => array(
        array(
            'taxonomy' => 'team_categories',
            'field'    => 'slug',
            'terms'    => 'SLUG FOR PARTICULAR TERM',
        ),
    ),
);
$query = new WP_Query( $args );

This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer here

remove copy and paste error
Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link.

Example

$args = array(
    'post_type' => 'team',
    'tax_query' => array(
        array(
            'taxonomy' => 'team_categories',
            'field'    => 'slug',
            'terms'    => 'SLUG FOR PARTICULAR TERM',
        ),
    ),
);
$query = new WP_Query( $args );

Multiple Taxonomy Handling

This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer here

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link.

Example

$args = array(
    'post_type' => 'team',
    'tax_query' => array(
        array(
            'taxonomy' => 'team_categories',
            'field'    => 'slug',
            'terms'    => 'SLUG FOR PARTICULAR TERM',
        ),
    ),
);
$query = new WP_Query( $args );

Multiple Taxonomy Handling

This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer here

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link.

Example

$args = array(
    'post_type' => 'team',
    'tax_query' => array(
        array(
            'taxonomy' => 'team_categories',
            'field'    => 'slug',
            'terms'    => 'SLUG FOR PARTICULAR TERM',
        ),
    ),
);
$query = new WP_Query( $args );

This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer here

add example code
Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link.

Example

$args = array(
    'post_type' => 'team',
    'tax_query' => array(
        array(
            'taxonomy' => 'team_categories',
            'field'    => 'slug',
            'terms'    => 'SLUG FOR PARTICULAR TERM',
        ),
    ),
);
$query = new WP_Query( $args );

Multiple Taxonomy Handling

This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer here

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link. This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer here

You have a few flaws in your code that are causing this failure

First of all, and most important of all, never (my emphasis) use query_posts to construct a custom query.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination)

Rather use a class like WP_Query to construct custom queries

As for the reason your query fails when using the category parameter, it is quite obvious that you are not making use of categories, or actually category terms :-). You are making use of a custom taxonomy with terms, which does not work with the category parameters in WP_Query. You should be making use of the tax parameters (tax_query) which you can go and check out in this link.

Example

$args = array(
    'post_type' => 'team',
    'tax_query' => array(
        array(
            'taxonomy' => 'team_categories',
            'field'    => 'slug',
            'terms'    => 'SLUG FOR PARTICULAR TERM',
        ),
    ),
);
$query = new WP_Query( $args );

Multiple Taxonomy Handling

This link will also provide details on how to construct a proper query using WP_Query

For the difference between a category and a custom taxonomy, go and read my answer here

Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209
Loading