Wordpress 永久链接显示为已更新,但所有链接仍然指向旧的永久链接

问题描述 投票:0回答:2

我有一个自定义分类设置,称为“产品类别”。如果我创建一个类别,例如“牛”并将 slug 设置为 /cattle/ - 当我转到 site.com/product-category/cattle 时,它工作正常。

但是,如果我然后进入 wp-admin,并将类别的 slug 编辑为 /cattle-feed/,则指向此特定类别的所有链接仍显示为 /cattle/ - 两者都在管理面板中(如果我单击类别上的“查看”)、wp 菜单中以及使用“get_category_link()”时在前端上。

/牛/ 变成 404(它应该)。 /cattle-feed/ 成为正确的分类类别存档(它应该如此)。 admin、wp-menu 和前端中的所有链接都转到 /cattle/,但它被正确设置为 /cattle-feed/

这是分类代码:

 
add_action( 'init', 'west_create_products_category_taxonomy', 0 );
 
//create a custom taxonomy name it subjects for your posts
 
function west_create_products_category_taxonomy() {
  
  $labels = array(
    'name' => _x( 'Product Categories', 'taxonomy general name' ),
    'singular_name' => _x( 'Product Category', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Categories' ),
    'all_items' => __( 'All Categories' ),
    'parent_item' => __( 'Parent Category' ),
    'parent_item_colon' => __( 'Parent Category:' ),
    'edit_item' => __( 'Edit Category' ), 
    'update_item' => __( 'Update Category' ),
    'add_new_item' => __( 'Add New Category' ),
    'new_item_name' => __( 'New Category Name' ),
    'menu_name' => __( 'Product Categories' ),
  );    
 
// Now register the taxonomy
  register_taxonomy('product_category',array('products', 'post'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'has_archive' => true,
    'rewrite' => array( 'slug' => 'product-category' ),
  ));
 
}

我尝试过刷新永久链接。我在这里错过了什么?

wordpress permalinks slug custom-taxonomy
2个回答
0
投票

事实证明这是 WPML 插件的问题,该插件阻止了 slugs 的更新。解决方法是进入 WPML > 支持 > 故障排除,然后按“清理”下的所有按钮。 (他们的支持告诉我要推动他们所有人!)。

荒谬,但是嘿嗬 - 解决了!


0
投票

转至 WPML > 支持 > 故障排除 > 清理 > 单击“将本地作业 ID 与 ATE 作业同步”!!!这对我有用。

© www.soinside.com 2019 - 2024. All rights reserved.