Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php ACF-仅当值与当前分类法相关时,才从repeater子字段获取元密钥_Php_Mysql_Wordpress_Metadata_Advanced Custom Fields - Fatal编程技术网

Php ACF-仅当值与当前分类法相关时,才从repeater子字段获取元密钥

Php ACF-仅当值与当前分类法相关时,才从repeater子字段获取元密钥,php,mysql,wordpress,metadata,advanced-custom-fields,Php,Mysql,Wordpress,Metadata,Advanced Custom Fields,我有称为“品牌”的帖子类型和称为“类别品牌”的分类法。 在“品牌”职位类型下,我有一个转发器字段。 该repeater字段包括两个子字段:编号字段“grade”,分类字段“category”(分类显示“category_brand”下的所有类别) 看起来是这样的: 在“category_brand”的分类法档案中,我只显示当前分类法的“brands” 职位的顺序需要按“级别”子字段(从大到小)排列 我很难从中继器下的成绩字段中获取“元键”。 问题是,只有当“grade”字段与当前的分类法相关时

我有称为“品牌”的帖子类型和称为“类别品牌”的分类法。 在“品牌”职位类型下,我有一个转发器字段。 该repeater字段包括两个子字段:编号字段“grade”,分类字段“category”(分类显示“category_brand”下的所有类别)

看起来是这样的:

在“category_brand”的分类法档案中,我只显示当前分类法的“brands”

职位的顺序需要按“级别”子字段(从大到小)排列

我很难从中继器下的成绩字段中获取“元键”。 问题是,只有当“grade”字段与当前的分类法相关时,我才需要得到它——repeater中的“category”子字段

这是密码

 $current_object=get_queried_object();
 $current_object_tax= $current_object->taxonomy;
 $current_object_tax_id= $current_object->term_id;

$post_args_current_tax = array(
   'post_type' => 'brands',
    'tax_query' => array(
      array(
      'taxonomy'=>  $current_object_tax,
       'field'=> 'term_id',
      'terms' =>   $current_object_tax_id,
   ),
 ),
     'posts_per_page' =>  -1,
     'meta_key'=> 'categorygrade_0_grade',
     'orderby'=> 'meta_value_num',
     'order'    => 'DESC',
     );
     $post_query_current_tax = new WP_Query($post_args_current_tax);
现在这个meta_键:'meta_键'=>'categorygrade\u 0_grade', 获取中继器下的所有等级,而不仅仅是与当前分类相关的等级。 只有当它与repeater中的当前分类法相关时,我如何才能获得分数