为单个服装更改 wordpress 永久链接 post
change wordpress Permalink for a single costum post
我正在使用具有固定链接结构的 wordpress:
http://www.example.com/article/
是否可以让 url 的 id 用于单个服装 post?
像这样:http://www.example.com/postid=1234
Post 基于 ID 的固定链接始终适用于所有帖子和页面,只会将您重定向到固定链接版本。
Default: "Ugly"
The default looks like
<a href="http://example.com/?p=N" rel="nofollow">http://example.com/?p=N</a>
where N is the Post ID number. It works on all server environments, but it doesn't look as nice as some of the other options.
发件人:Using Permalinks
使用这个
在条件下,您必须提供您正在使用的 post 类型
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 );
我正在使用具有固定链接结构的 wordpress:
http://www.example.com/article/
是否可以让 url 的 id 用于单个服装 post?
像这样:http://www.example.com/postid=1234
Post 基于 ID 的固定链接始终适用于所有帖子和页面,只会将您重定向到固定链接版本。
Default: "Ugly"
The default looks like
<a href="http://example.com/?p=N" rel="nofollow">http://example.com/?p=N</a>
where N is the Post ID number. It works on all server environments, but it doesn't look as nice as some of the other options.
发件人:Using Permalinks
使用这个 在条件下,您必须提供您正在使用的 post 类型
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 );