【发布时间】:2016-02-26 12:32:30
【问题描述】:
我正在使用带有永久链接结构的 wordpress:
http://www.example.com/article/
是否可以将带有 id 的 url 用于单个 costum 帖子?
类似这样的东西:http://www.example.com/postid=1234
【问题讨论】:
标签: wordpress permalinks
我正在使用带有永久链接结构的 wordpress:
http://www.example.com/article/
是否可以将带有 id 的 url 用于单个 costum 帖子?
类似这样的东西:http://www.example.com/postid=1234
【问题讨论】:
标签: wordpress permalinks
基于帖子 ID 的固定链接始终适用于所有帖子和页面,并且只会将您重定向到固定链接版本。
默认:“丑”
默认的样子
@987654321@其中 N 是 Post ID 号。它适用于所有服务器环境,但看起来不如其他一些选项好。
发件人:Using Permalinks
【讨论】:
使用这个 如果您必须提供您使用的帖子类型
function append_query_string( $url, $post ) {
if ( 'product' == get_post_type( $post ) ) {
return $url."?postid=$post->ID" ;
}
return $url;
}
add_filter( 'post_type_link', 'append_query_string', 10, 2 );
【讨论】: