2014-09-01 4 views
0

사용자 정의 게시 유형의 분류 조회가 결과를 표시하지 않습니다. 사용자 정의 유형 표시 결과에 대한 정기적 인 쿼리. 사용자 정의 유형에 사용자 정의 세금을 지정할 수 있습니다. 쿼리를 실행하면 오류가 발생합니다. 이 오류를 얻을 :wordpress - wp query 사용자 정의 유형/세금 표시가 표시되지 않습니다.

Notice: Undefined offset: 0 in /Applications/MAMP/htdocs/folsom/wp-includes/query.php on line 2526 

가 여기 내 쿼리 :

 $args = array(
      'post_type' => 'product', 
      'tax_query' => array(
       array(
        'taxonomy' => 'product-cat', 
        'term' => 'featured', 
        'field' => 'slug' 
        ) 
      ) 
     ); 

** 업데이트 :이 완료되기 전에 Enter 키를 누르십시오. 더 많은 정보를 추가하는 과정에 있음

** 업데이트 : args의 게시물 유형에 분류법을 추가하고 세금 우선 순위를 정의하여 먼저 등록했습니다.

add_action('init', 'create_product_taxonomies', 0); 

add_action('init', 'setup_custom_post'); 
function setup_custom_post(){ 
$args = array(
    'label'     => 'products', 
    // Bunch of other stuff 
    'taxonomies'   => array('product-cat'), 
    ), 

); 

register_post_type('product', $args); 
} 
+1

대한 추가 정보를 원하시면 방문 http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters를 들어

$args = array( 'post_type' => 'product', 'tax_query' => array( array( 'taxonomy' => 'product-cat', 'terms' => 'featured', 'field' => 'slug' ) ) ); 

: 그래서 당신의 인수 배열은 다음과 같습니다? –

답변

1

잘못된 택 소미 매개 변수를 추가 한 것으로 보입니다. '용어'대신 '용어'를 사용하십시오. 당신이 다른 의견을 추가 건가요

+0

오타. 항상 오타가 ... : / – Plummer

관련 문제