1

Google で最高の SEO を実現するために、URL からタグを削除したいと考えています。例えば:

古い URL:

example.com/tag/hello

私はそれが欲しい:

example.com/hello

ワードプレスでそれを行うにはどうすればよいですか?また、古い URL から直接 URL を作成するにはどうすればよいですか?

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 );
    }

このコードは、次のような URL を作成します。

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

することが:

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

タグの削除にご協力ください。

4

1 に答える 1

1

このプラグインを見つけて、URL WP-No-tag-baseからタグを削除しました

于 2013-10-25T02:39:25.233 に答える