我在WordPress查询选项中有以下数组用于输出产品类别,我需要按类别ID从中排除某些值,我该怎么办?
$args = apply_filters( 'storefront_product_categories_args', array(
'limit' => 12,
'columns' => 3,
'child_categories' => 0,
'orderby' => 'name',
'order' => 'asc',
'title' => __( '', 'storefront' ),
非常感谢。
答案 0 :(得分:1)
通过密钥从PHP数组中删除项目是使用unset
函数完成的:
$array = array(
'limit' => 12,
'columns' => 3,
'child_categories' => 0,
'orderby' => 'name',
'order' => 'asc',
'title' => 'something',
);
unset( $array[ 'columns' ] );
var_dump( $array );