Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hello I'm creating a custom url rewrite structure for my WordPress site.

First I had the following code to have url: /objekt/<GID> which loads objekt page and have query var GID.

add_action( 'init', 'objekt_url_rewrites_init' );

function objekt_url_rewrites_init(){
add_rewrite_rule(
        'objekt/([A-Za-z_0-9]+)/?$',
        'index.php?pagename=objekt&GID=$matches[0]',
        'top' );
}

add_filter( 'query_vars', 'objekt_url_query_vars' );
function objekt_url_query_vars( $query_vars ){
    $query_vars[] = 'GID';
    return $query_vars;
}

Now, I need to change URL structure to /en/objekt/<GID>. So, I change

objekt/([A-Za-z_0-9]+)/?$

to

en/objekt/([A-Za-z_0-9]+)/?$

But its not working! :( Please help

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.