Rewrite url for custom post type

this will not work:

'en/index.php?post_type=vinos'

there is no en/index.php, it has to be:

'index.php?post_type=vinos'

if you need to detect en in the path, add a query var, then set that query var in your rewrite:

function wpa_query_vars( $qvars ) {
    $qvars[] = 'wpa_lang';
    return $qvars;
}
add_filter( 'query_vars', 'wpa_query_vars' );

then in your rewrite rule:

$newrules['en/our-wines/catalog/?$'] = 'index.php?post_type=vinos&wpa_lang=en';

Leave a Comment