我建议在array param中添加meta\\u查询,请尝试以下操作
add_shortcode( \'sc_count_brands\', \'sc_count_brands_code\' );
function sc_count_brands_code($atts) {
$values = shortcode_atts( array(\'category\' => \'Horology\',), $atts );
$args = array(
\'post_type\' => \'brands\',
\'post_status\' => \'publish\',
\'meta_query\' => array(
array(
\'key\' => \'br_category\',
\'value\' => esc_attr($values[\'category\']),
\'compare\' => \'=\'
),
),
);
$query = new WP_Query( $args );
$countn = $query->found_posts;
$buffer = \'<span class="magby">Featuring </span><span class="axiac">\' . $countn . \'</span><span class="magby"> brands</span>\';
wp_reset_postdata();
return $buffer;
}