Wordpress ACF中继器字段和多个子字段已在今天日期前检查

Wordpress ACF中继器字段和多个子字段已在今天日期前检查,wordpress,advanced-custom-fields,acfpro,Wordpress,Advanced Custom Fields,Acfpro,我有一个名为“今天”的自定义字段(中继器)。在其中,我有一个“选择日历日期”子字段 在产品(woocommerce)上,我添加了1、2、3个或更多日期。返回日期类似于dd/mm,我得到的是今天的日期与类似的日期(d/m)进行比较 问题是加载时间非常长,我没有得到任何结果 我所尝试的: $today = date('d/m'); $args = array( 'numberposts' => -1, 'post_type' => 'product',

我有一个名为“今天”的自定义字段(中继器)。在其中,我有一个“选择日历日期”子字段

在产品(woocommerce)上,我添加了1、2、3个或更多日期。返回日期类似于dd/mm,我得到的是今天的日期与类似的日期(d/m)进行比较

问题是加载时间非常长,我没有得到任何结果

我所尝试的:

$today = date('d/m');

$args = array(
    'numberposts'   => -1,
    'post_type'     => 'product',
    'meta_query'    => array(
        'relation'      => 'AND',
        array(
            'key'       => 'today_$_mdate',
            'compare'   => '=',
            'value'     => $today
        )
    )
);

    $the_query = new WP_Query( $args );

    if( $the_query->have_posts() ): ?>
    <ul>
    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
        <li>
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
        </li>
    <?php endwhile; ?>
    </ul>
<?php else:
    echo "No prods"; endif; ?>

<?php wp_reset_query(); 
新方法:

$today = date('d/m');

$args = array(
    'post_type'      => 'product',
    'posts_per_page' => -1
);

$products = new WP_Query( $args );

if ( $products->have_posts() ) {
  echo '<ul>';
    while ( $products->have_posts() ) {
        $products->the_post();
        if( have_rows('today') ):
            while ( have_rows('today') ) : the_row();
                the_sub_field('mdate');
            endwhile;
        else :
            // no rows found
        endif;
    }
  echo "</ul>";
}

wp_reset_query();
$today=日期('d/m');
$args=数组(
“post_类型”=>“产品”,
“每页帖子”=>-1
);
$products=新的WP_查询($args);
如果($products->have_posts()){
回声“
    ”; 而($products->have_posts()){ $products->the_post(); 如果(有行(“今天”): while(have_row('today'):the_row(); _sub_字段('mdate'); 结束时; 其他: //找不到行 endif; } 回声“
”; } wp_reset_query();
仍然有大量的加载时间。。。消息
致命错误:允许内存大小536870912字节已用尽。。。在wp includes/plugin.php第179行


但至少,我可以根据其转发器子字段过滤产品。

此问题已修复。从ACF自定义字段设置中,只需将repeater字段模式设置为line而不是table。对我来说,它被设置为table,我有biiiig加载时间和崩溃。

你的日期字段的“保存格式”是什么?@OutsourceWordPress很抱歉延迟了回答。我的保存/返回格式设置为自定义d/m,如下图所示:您能确保您使用的是最新版本的ACF和ACF Repeater插件吗?它是专业版,并且完全更新。我的插件不需要更新。那么可能是您的内存限制非常低,请尝试将其添加到'wp config.php'-
define('wp\u memory\u limit','256M')并再次检查。
$today = date('d/m');

$args = array(
    'post_type'      => 'product',
    'posts_per_page' => -1
);

$products = new WP_Query( $args );

if ( $products->have_posts() ) {
  echo '<ul>';
    while ( $products->have_posts() ) {
        $products->the_post();
        if( have_rows('today') ):
            while ( have_rows('today') ) : the_row();
                the_sub_field('mdate');
            endwhile;
        else :
            // no rows found
        endif;
    }
  echo "</ul>";
}

wp_reset_query();