Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.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
Arrays Wordpress查询';在'中发布"名称"=&燃气轮机;数组($分解数组)不工作_Arrays_Wordpress - Fatal编程技术网

Arrays Wordpress查询';在'中发布"名称"=&燃气轮机;数组($分解数组)不工作

Arrays Wordpress查询';在'中发布"名称"=&燃气轮机;数组($分解数组)不工作,arrays,wordpress,Arrays,Wordpress,我有一个数组,我分解并成功地回显了,但如果我尝试在查询中使用它,它需要工作 $result_string = "'" . str_replace(",", "', '", $hexcode) . "'"; echo $result_string; 这回声是“暗灰色”、“暗灰色”、“黑色”、“锡耶纳” 我的args数组如下所示: $args = array ( 'post_type' => array( 'farben' )

我有一个数组,我分解并成功地回显了,但如果我尝试在查询中使用它,它需要工作

$result_string = "'" . str_replace(",", "', '", $hexcode) . "'";
echo $result_string;
这回声是“暗灰色”、“暗灰色”、“黑色”、“锡耶纳” 我的args数组如下所示:

$args = array (
                    'post_type'              => array( 'farben' ),
                    'post_status'            => array( 'publish' ),
                    'order'                  => 'ASC',
                    'orderby'                => 'menu_order',
                    'post_name__in' => array( 'DimGray', 'DarkGray', 'Black', 'Sienna' )

                );
这也行得通。但是我需要做什么才能在数组中的post\u name\u中回显我的字符串呢?我试着这样做:

'post_name__in' => array( $result_string )

但它需要工作。有什么想法吗?感谢您提供的任何提示。

请尝试将所有提示替换为以下内容:

$result\u string=explode(',',$hexcode);
$args=数组(
“post_type”=>数组('farben'),
“发布状态”=>数组(“发布”),
“订单”=>“ASC”,
'orderby'=>'菜单\u顺序',
'post_name___in'=>$result_字符串

);生成
结果\u字符串
数组。然后使用=>$result\u string你能发布一个你想在查询中使用的示例字符串吗?哦,我的加油,你是我的英雄!!!非常感谢你!为什么现在看起来这么容易!:-)