Viewing 7 replies - 1 through 7 (of 7 total)
  • No. The keyword ‘tag’ is reserved for tag listing pages.

    moisty70,

    esmi is correct. Please refer to the codex on permalink usage: https://codex.www.ads-software.com/Using_Permalinks

    Thread Starter moisty70

    (@moisty70)

    May be I did not explain well. %tag% is in the list at https://codex.www.ads-software.com/Using_Permalinks

    I am using permalink custom structure: /%tag%/%category%/%postname%

    every direct link is working fine, the problem is the Post title links shown in home or archive.php they are substituded for /tag/category-name/post-name instead of /tag-name/category-name/post-name.

    May be has to do with slug on tags.

    Thread Starter moisty70

    (@moisty70)

    sorry I forgot the %

    the title links ar substituted by
    /%tag%/category-name/post-name

    Ah – you want https://domain.com/tag_name/category-name/post-name?

    I can see some problems with that structure. For example, do you have any tags and categories with the same name?

    Thread Starter moisty70

    (@moisty70)

    Yes, thats it.

    I have a news site in english and spanish and planned to have urls that way.

    Only tags are: en (english) and es (spanish)
    Categories are the same for both languages.

    I need this way because I will use the rss on other website, filtered by language and language+category.

    When I type the url https://domain.com/tag_name/category-name/post-name it works, the problem is the title link (the_permalink()) href is https://domain.com/%tag%/category-name/post-name
    (%tag% not tag-name)

    Thread Starter moisty70

    (@moisty70)

    Got it,
    Function get_permalink on link-template.php is missing the code for %tag%.
    I created it similar than for %category% and worked.

    $rewritecode = array(
    		'%year%',
    		'%monthnum%',
    		'%day%',
    		'%hour%',
    		'%minute%',
    		'%second%',
    		$leavename? '' : '%postname%',
    		'%post_id%',
    		'%category%',
    		'%author%',
    		$leavename? '' : '%pagename%',
    		'%tag%',
    	);
    
    **********************
    
    		if ( strpos($permalink, '%tag%') !== false ) {
    			$tags = get_the_tags($post->ID);
    			if ( $tags ) {
    				usort($tags, '_usort_terms_by_ID'); // order by ID
    				$tag = $tags[0]->slug;
    			}
    			// show default category in permalinks, without
    			// having to assign it explicitly
    			if ( empty($tag) )
    			{
    				$tag=<My default tag>
    			}
    		}
    
    ****************************
    
    		$rewritereplace =
    		array(
    			$date[0],
    			$date[1],
    			$date[2],
    			$date[3],
    			$date[4],
    			$date[5],
    			$post->post_name,
    			$post->ID,
    			$category,
    			$author,
    			$post->post_name,
    			$tag,
    		);
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Permalinks to /%tag%/?tegory%/%postname%’ is closed to new replies.