我安装了 edd 插件并添加了产品。当我单击单个页面的产品或单击任何 edd 类别时,插件生成的链接 http://site_url/downloads/category/recent-issues/
。现在我想更改帖子类型。
喜欢
给
我从谷歌搜索并找到了这段代码。
function add_custom_rewrite_rule() {
$current_rules = get_option('rewrite_rules');
if( ($current_rules) ) {
foreach($current_rules as $key => $val) {
if(strpos($key, 'download') !== false) {
add_rewrite_rule(str_ireplace('download', 'issues', $key), $val, 'top');
} // end if
} // end foreach
} // end if/else
// ...and we flush the rules
flush_rewrite_rules();
} // end add_custom_rewrite_rule
add_action('init', 'add_custom_rewrite_rule');
但是这段代码不起作用。 “下载”是edd产品的post类型。
那么我该如何更改 edd post 类型的 slug。
最佳答案
关于php - 如何在 wordpress 中更改自定义帖子类型 slug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35173900/