<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Cme non fare comparire la categoria madre ma solo la sotto categoria]]></title><description><![CDATA[<p dir="auto">Ciao a tutti, sto apportando delle modifiche alle categorie del mio sito ma in questo momento i permalink vengono così visualizzati <strong>nomedominio. it/ category/category+nome città/postname</strong><br />
Vorrei invece fare comparire questa struttura <strong>nomedominio . com/category+nomecittà/postname.</strong>  Category sta ad es. per "concerti" e "category+ nome città" sta ad es. per "concerti-roma")Mi è stato consigliato di usare il Seo by Yoast e selezionare nelle impostazioni il permalink il flag "rimuovi categoria", ma continua a non risolversi.<br />
Allo stesso tempo, però, vedo che nelle impostazioni del template i permalink sono impostati sulla "struttura personalizzata" con il seguente codice inserito a suo tempo prima di creare le sotto categorie: /%category%/%postname%/   . Ci può essere un conflitto che non fa eliminare la category madre?</p>
<p dir="auto">Sapete dirmi come fare?<br />
Grazie a tutti!﻿<br />
Johnny</p>
]]></description><link>https://dev.connect.gt/topic/201302/cme-non-fare-comparire-la-categoria-madre-ma-solo-la-sotto-categoria</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 09:39:47 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/201302.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 Apr 2014 09:03:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cme non fare comparire la categoria madre ma solo la sotto categoria on Thu, 17 Apr 2014 09:19:17 GMT]]></title><description><![CDATA[<p dir="auto">Ciao mcrapanzano <strong>, grazie dell'info. Credo che mi orienterò sul plug in che mi sembra più semplice</strong></p>
<p dir="auto"><strong>A presto!</strong></p>
]]></description><link>https://dev.connect.gt/post/1159051</link><guid isPermaLink="true">https://dev.connect.gt/post/1159051</guid><dc:creator><![CDATA[johnny.p]]></dc:creator><pubDate>Thu, 17 Apr 2014 09:19:17 GMT</pubDate></item><item><title><![CDATA[Reply to Cme non fare comparire la categoria madre ma solo la sotto categoria on Wed, 16 Apr 2014 15:56:09 GMT]]></title><description><![CDATA[<p dir="auto">Oppure il Plugin [h=2]Custom Permalinks[/h]</p>
]]></description><link>https://dev.connect.gt/post/1159054</link><guid isPermaLink="true">https://dev.connect.gt/post/1159054</guid><dc:creator><![CDATA[mcrapanzano]]></dc:creator><pubDate>Wed, 16 Apr 2014 15:56:09 GMT</pubDate></item><item><title><![CDATA[Reply to Cme non fare comparire la categoria madre ma solo la sotto categoria on Wed, 16 Apr 2014 15:52:27 GMT]]></title><description><![CDATA[<p dir="auto">Prova questa soluzione:</p>
<p dir="auto">// Remove category base<br />
add_filter('category_link', 'no_category_parents',1000,2);<br />
function no_category_parents($catlink, $category_id) {<br />
$category = &amp;get_category( $category_id );<br />
if ( is_wp_error( $category ) )<br />
return $category;<br />
$category_nicename = $category-&gt;slug;</p>
<pre><code>$catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $category_nicename, 'category' );
return $catlink;
</code></pre>
<p dir="auto">}</p>
<p dir="auto">// Add our custom category rewrite rules<br />
add_filter('category_rewrite_rules', 'no_category_parents_rewrite_rules');<br />
function no_category_parents_rewrite_rules($category_rewrite) {<br />
//print_r($category_rewrite); // For Debugging</p>
<pre><code>$category_rewrite=array();
$categories=get_categories(array('hide_empty'=&gt;false));
foreach($categories as $category) {
    $category_nicename = $category-&gt;slug;
    $category_rewrite['('.$category_nicename.')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&amp;feed=$matches[2]';
    $category_rewrite['('.$category_nicename.')/page/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&amp;paged=$matches[2]';
    $category_rewrite['('.$category_nicename.')/?$'] = 'index.php?category_name=$matches[1]';
}
// Redirect support from Old Category Base
global $wp_rewrite;
$old_base = $wp_rewrite-&gt;get_category_permastruct();
$old_base = str_replace( '%category%', '(.+)', $old_base );
$old_base = trim($old_base, '/');
$category_rewrite[$old_base.'$'] = 'index.php?category_redirect=$matches[1]';


//print_r($category_rewrite); // For Debugging
return $category_rewrite;
</code></pre>
<p dir="auto">}</p>
<p dir="auto">// Add 'category_redirect' query variable<br />
add_filter('query_vars', 'no_category_parents_query_vars');<br />
function no_category_parents_query_vars($public_query_vars) {<br />
$public_query_vars[] = 'category_redirect';<br />
return $public_query_vars;<br />
}<br />
// Redirect if 'category_redirect' is set<br />
add_filter('request', 'no_category_parents_request');<br />
function no_category_parents_request($query_vars) {<br />
//print_r($query_vars); // For Debugging<br />
if(isset($query_vars['category_redirect'])) {<br />
$catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $query_vars['category_redirect'], 'category' );<br />
status_header(301);<br />
header("Location: $catlink");<br />
exit();<br />
}<br />
return $query_vars;<br />
}</p>
]]></description><link>https://dev.connect.gt/post/1159052</link><guid isPermaLink="true">https://dev.connect.gt/post/1159052</guid><dc:creator><![CDATA[mcrapanzano]]></dc:creator><pubDate>Wed, 16 Apr 2014 15:52:27 GMT</pubDate></item></channel></rss>