Remove word “tag" from tag archive

Posted in: Newsmag
Post count: 48

Hi,
I am looking for a solution to remove the word “tag:” from the tag archive page. how can i remove the word?

Post count: 9544

You can change it from the WordPress settings to something else like /topics/ — but not managed by the theme in any way.

You will want to do Google search for a function to add to your functions file to remove the tag ‘slug’ from tags.

ref
http://stackoverflow.com/questions/17798815/remove-category-tag-base-from-wordpress-url-without-a-plugin

I have not yet tested this:

// remove tag base
add_filter('tag_rewrite_rules', 'no_tag_base_rewrite_rules');
function no_tag_base_rewrite_rules($tag_rewrite) {
$tag_rewrite=array();
$tags=get_tags(array('hide_empty'=>false));
foreach($tags as $tag) {
$tag_nicename = $tag->slug;
if ( $tag->parent == $tag->tag_ID )
$tag->parent = 0;
elseif ($tag->parent != 0 )
$tag_nicename = get_tag_parents( $tag->parent, false, '/', true ) . $tag_nicename;
$tag_rewrite['('.$tag_nicename.')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?tag=$matches[1]&feed=$matches[2]';
$tag_rewrite['('.$tag_nicename.')/page/?([0-9]{1,})/?$'] = 'index.php?tag=$matches[1]&paged=$matches[2]';
$tag_rewrite['('.$tag_nicename.')/?$'] = 'index.php?tag=$matches[1]';
}
global $wp_rewrite;
$old_base = $wp_rewrite->get_tag_permastruct();
$old_base = str_replace( '%tag%', '(.+)', $old_base );
$old_base = trim($old_base, '/');
$tag_rewrite[$old_base.'$'] = 'index.php?tag_redirect=$matches[1]';
return $tag_rewrite;
}

Post count: 48

Well i am not talking about the change in URL but the title of the archive page which you can see here on this link written as Tag: Special Reports under the menu bar.

Post count: 48

I tried the following in CSS and it seems to work for now.

.td-page-title {
display: none;
}

is it a good way to do it?

Post count: 9544

sorry …
thought you were referring to the slug/url
http://www.morenews.pk/tag/special-reports/

If it were me, I’d just change it in the template file “tag.php”

<span><?php echo __td('Tag');?>: <?php echo $current_tag_name ?></span>

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newsmag’ is closed to new topics and replies.