wordpress - 帖子类型有多个单词时查询wordpress自定义帖子类型
问题描述
我有一个custom post type
名字What We Do
注册如下,
function cp_what_we_do() {
register_post_type('What We Do', array(
'labels' => array(
'name' => 'What We Do',
'singular_name' => 'wwd',
'add_new_item' => 'Add New Item',
'edit_item' => 'Edit WWD Item',
),
'description' => 'What We Do',
'public' => true,
'menu_position' => 20,
'supports' => array('title','editor')
));
}
add_action('init', 'cp_what_we_do');
我查询上面的自定义帖子,例如,
$args = array(
'numberposts' => -1,
'post_type' => 'What We Do',
'order' => 'ASC',
'post_status'=>'publish',
'posts_per_page' => $countNo
);
$the_query = new WP_Query($args);
上面的查询返回No Posts。但是相同的过程适用于帖子类型services
,并且效果很好。当我对post_type
( What We Do
) 有多个单词时,查询不返回任何值。请有人详细说明这个问题。
解决方案
推荐阅读
- apk - × 构建失败如何解决。独立构建失败!在安卓博览会?
- xslt - 如何在 XSLT 中为属性使用多个值
- python - 通过java执行python代码将日志保存到文件
- java - DB2 中使用 INTERSECT 的交集
- node.js - EXPRESS : 如何防止 Fetch() 用缓存的响应进行响应
- linux - 用 awk 剪切我的 FILENAME 变量的输出?
- ios - 如何修复错误:“应用标识符“com.example.apple-samplecode.BreakfastFinder”无法注册到您的开发团队。
- regex - RegEx Pattern - 如何从一行中提取 N 元素?
- haskell - Haskell String to List String 按空格分割
- docker - 使用持久注册表文件在 Kubernetes 中运行 Filebeat?