Assuming your URLs are of the form
/<category>/<post-name>/ (trailing slash optional) then an
.htaccess only solution would look something like the following, at the top of your
# Remove some categories from the URL
RewriteRule ^(ricette|svezzamento|alimentazione)/([^/]+)/?$ /$2/ [R=301,L]
$2 backreference (in the
RewriteRule substitution) matches the
<post-name> from the requested URL.
It is preferable to first test with 302 (temporary) redirects in order to avoid potential caching issues.
https://www.example.com/la-crescita/ricette/name-post and I need go to
yes "la-crescita" is the first category and "ricette" is the subcategory of "la-crescita". File .htaccess is in the root of WordPress
/la-crescita is always the main category and "ricette", "svezzamento" and "alimentazione" and subcategories of this main category then you need to modify the above directive to include the category. For example:
RewriteRule ^la-crescita/(ricette|svezzamento|alimentazione)/([^/]+)/?$ /$2/ [R=301,L]