如何从网址中删除标记

时间:2013-10-24 12:53:45

标签: wordpress url tags

我想从网址中删除标记,以帮助Google获得最佳搜索引擎优化。例如:

旧网址:

example.com/tag/hello

我希望它是:

example.com/hello

我如何在wordpress中这样做?如何直接从旧网址创建网址?

我在functions.php中使用此代码:

function stf_redirect_to_post(){
    global $wp_query;

    // If there is one post on archive page
    if( is_archive() && $wp_query->post_count == 1 ){
        // Setup post data
        the_post(); 
        // Get permalink
        $post_url = get_permalink();
        // Redirect to post page
        wp_redirect( $post_url );
    }

此代码生成任何网址:

http://example.com/tag/sms/

是:

http://example.com/special-offers/website-messages/

请帮助删除标记。

1 个答案:

答案 0 :(得分:1)

我发现此插件会从网址WP-No-tag-base

中删除该标记
相关问题