我正在寻找一个插件或一点php,它将通过大约300篇使用旧p格式超链接的帖子:
<a href="http://mysite.com/?p=3592">
并自动将其替换为他们的%postname%pretty permalink。例如:<a href="http://mysite.com/my-post-about-whatever">
无论出于何种原因,当我们更改Permalink结构时,这些帖子不会自动神奇地做到这一点,所以我们目前正在逐一进行。数千个链接。我认为,问题是我们最初是从静态HTML页面导入它们的。我想知道他们不会自动重写是不是因为我们使用了自定义的帖子类型?
或者,我们设置阻止自动重写的分类法的方式有问题吗?如果是,有人能提供一些建议吗。这是我们对这种自定义帖子类型(docs)的分类
//helpdocs taxonomy
add_action( \'init\', \'create_docs_post_type\' );
function create_docs_post_type() {
$labels = array(
\'name\' => __( \'Documentation\' ),
\'singular_name\' => __( \'Documentation\' )
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'capability_type\' => \'page\',
\'has_archive\' => true,
\'hierarchical\' => true,
\'menu_position\' => 50,
\'supports\' => array( \'title\', \'editor\', \'author\', \'thumbnail\', \'excerpt\',
\'comments\', \'custom-fields\', \'revisions\',\'page-attributes\',\'post-formats\' )
);
register_post_type( \'docs\', $args);
}
function docs_init() {
// create a new taxonomy
register_taxonomy(
\'docs_tax\',
\'docs\',
array(
\'label\' => __( \'Documentation_Tax\' ),
\'sort\' => true,
\'args\' => array( \'orderby\' => \'term_order\' ),
\'hierarchical\' => true,
\'rewrite\' => array( \'slug\' => \'docs\' )
)
);
}
add_action( \'init\', \'docs_init\' );
TIA,---JC公司