显示帖子如果是true/false是没有ACF的

发布于 2025-02-05 17:36:29 字数 288 浏览 3 评论 0原文

如何仅显示帖子,“ Nezobrazovat”字段是错误的?

这是我的代码:

        $args = array(
            'posts_per_page' => 3,
            'post_type' => 'mycustompost',
            'key'=> 'nezobrazovat',
            'value'=>'no',
        );

这不起作用,所有前3个帖子均显示

How to display only posts, what have field "nezobrazovat" as false?

This is my code:

        $args = array(
            'posts_per_page' => 3,
            'post_type' => 'mycustompost',
            'key'=> 'nezobrazovat',
            'value'=>'no',
        );

This doesnt work, all first 3 posts are displayed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挥剑断情 2025-02-12 17:36:29

从ACF文档中值为1或0

$posts = get_posts( array(
    'meta_query' => array(
        array(
            'key'   => 'show_in_sidebar',
            'value' => '1',
        )
    )
) );

https://wwwwwwwwwwwwwww.customfields.com/ressources/resiors.com/resources /true-false/

From the acf docs the value is 1 or 0

$posts = get_posts( array(
    'meta_query' => array(
        array(
            'key'   => 'show_in_sidebar',
            'value' => '1',
        )
    )
) );

https://www.advancedcustomfields.com/resources/true-false/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文