这里是一个数组,我想提取“category_input”作为子数组。这个子数组包含“cat_id”和“post-titles”。然后,我想将帖子插入到每个类别下的WordPress DB中。是。 cat_20将有帖子命名为post-in-cat-20等等。php从数组中获取子数组
Array
(
[post_type] => post
[post_status] => publish
[content_texarea] =>
[category_input] => Array
(
[0] => cat_20
[1] => post-in-cat-20
[2] => post-in-cat-20
[3] => post-in-cat-20
[4] => cat_19
[5] => post-in-cat-19
[6] => post-in-cat-19
[7] => post-in-cat-19
[8] => post-in-cat-19
[9] => cat_2
[10] => post-in-cat-2
[11] => post-in-cat-2
[12] => post-in-cat-2
)
)
预期结果
提取阵列将作为
[category_input] => Array
(
[0] => cat_20
[1] => post-in-cat-20
[2] => post-in-cat-20
[3] => post-in-cat-20
[4] => cat_19
[5] => post-in-cat-19
[6] => post-in-cat-19
[7] => post-in-cat-19
[8] => post-in-cat-19
[9] => cat_2
[10] => post-in-cat-2
[11] => post-in-cat-2
[12] => post-in-cat-2
)
然后,我将需要caegory和岗位阵列中的WP查询
[category_input] => Array
(
[cat_20] => Array
[1] => post-in-cat-20
[2] => post-in-cat-20
[3] => post-in-cat-20
[cat_19] => Array
[5] => post-in-cat-19
[6] => post-in-cat-19
[7] => post-in-cat-19
[8] => post-in-cat-19
[cat_2] => Array
[10] => post-in-cat-2
[11] => post-in-cat-2
[12] => post-in-cat-2
)
请加上预期结果 –
哪一个是你的愿望输出?第二个?? –
是第二个结果 –