分类法重写段符意外字符%2F

问题描述

我有一个快速的问题需要解释。 我不知道该如何解决。

我用facetwpjetengine的wordpress创建了一个房地产网站, 我在property_category中创建了分类法

我需要重写段塞并自定义永久链接结构。但效果不理想。 在网址中而不是

/test/property/?_category=apartments

我看到了

/test/property/?_category=%2Fappartements%2F

如何删除这些%2F

怎么了?发生什么事了?

看到这张照片以了解一切

picture

更新22/08/2020

这似乎是比我想象的还要复杂的问题?

我必须用图片详细解释所有内容,以便您可以直观地看到问题所在。 我要复制的是使用wpresidence themefacetwpjetengine,除分类链接外,其他所有方法都工作正常。

您可以测试他们的网站,并告诉我我不了解的内容。 这似乎是粘贴以修改分类法的代码?

gist.facetwp上也可能有这些代码?

<?php
/** basic output of using facet links instead of taxonomy archive
 ** change 'my_taxonomy_name','fwp_my_facet_name','http://example.com/page_for_facets/'
 ** note that if using facetwp_index_row or facetwp_indexer_row_data to change the facetwp_value
 ** this would not work out of the box
 **/
$terms = get_the_terms( get_the_ID(),'my_taxonomy_name' );
if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) {
  foreach ( $terms AS $term ) {
    $name = $term->name;
    $link = add_query_arg( 'fwp_my_facet_name',FWP()->helper->safe_value( $term->slug ),'http://example.com/page_for_facets/' );
    echo "<a href='$link'>$name</a><br />"; // very basic output of link,change as need
  }
}

我不知道该怎么办

property single page

property archive page

更新22/08/2020 18:26

我发现这段代码解决了我的问题,我与之分享。

add_filter('term_link',function ($termlink,$term,$taxonomy) {
    if ('property_type' == $taxonomy) {
        $termlink = trailingslashit(get_home_url()) . 'property/?_category=' . $term->slug;
    }
    return $termlink;
},10,3);

解决方法

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

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

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...