wordpress查询自定义字段为特定值的文章
wordpress查询自定义字段为特定值的文章
'post', 'meta\_key'=>'identityNo', 'post\_status'=> 'publish', 'posts\_per\_page' => -1, 'meta\_query' => array( array( 'key' => 'identityNo', 'value' => $\_POST\['identityNo'\], ), ) ); $nQuery = new WP\_Query( $args ); if ( $nQuery -> have\_posts() ) { while ( $nQuery ->have\_posts() ) : $nQuery ->the\_post(); //loop endwhile; } ?>参考资料: http://jokerliang.com/wordpress-custom-fields-to-support-between-queries.html https://codex.wordpress.org/Class\_Reference/WP\_Query
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 WEIXING.ME!
评论