有人可以帮我改变我的永久链接。我使用的是JEtengine cpt,可以更改permalink结构吗?
从www.example.com/request/post_title到www.example.com/request/post_id?
在permalink wp设置中,更改设置不影响JetEngine CustomPostType.
有人有functions.php的代码片段或代码来改进这种更改吗?
发布于 2022-04-04 10:54:07
没有任何使用JetEngine CPT的经验,但您可以尝试:
add_filter('post_type_link', 'wpse404402_post_type_link', 10, 2);
function wpse404402_post_type_link( $link, $post = 0 ){
return home_url( 'cpt-type/' . $post->ID );
}别忘了在那之后冲洗果酱。
而且--也许JetEngine CPT也使用了这个过滤器,试着看看也许改变add_filter上的优先级会有帮助。如果插件使用此过滤器,也可以在其代码中进行搜索。
https://wordpress.stackexchange.com/questions/404402
复制相似问题