禁用所有WordPress&WooCommerce属性档案

问题描述

我想禁用woocommerce / wordpress的所有属性档案。我已经找到了下面的代码,它不能100%工作。问题是,当我对网站进行爬网时,属性存档页面仍然存在。我需要它们永远不会出现在前端。

add_action('template_redirect','remove_wp_archives');
 
function remove_wp_archives(){
  if( is_archive() ) {
    global $wp_query;
    $wp_query->set_404(); //set to 404 not found page
  }
}

thx

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)