Private variables don't work with rewrite rules (2 posts)

  1. fredCZ
    Posted 10 years ago #

    it seems that private (= user defined) variables are excluded from rewriting.

    this code:

    //testing code for Polyglot plugin
    add_filter('rewrite_rules_array', 'polyglot_generate_rewrite');

    $polyglot_rewrite_tag = '%lang%';
    $polyglot_query_var = 'lp_lang_view';
    $polyglot_link_base = 'lang';

    function polyglot_generate_rewrite($rewrite) {
    global $polyglot_rewrite_tag, $polyglot_query_var, $polyglot_link_base,$wp_rewrite;

    $wp_rewrite->add_rewrite_tag($polyglot_rewrite_tag, '([^/]{2,2})', "{$polyglot_query_var}=");
    $structure = $wp_rewrite->root . $polyglot_link_base . "/{$polyglot_rewrite_tag}/%post_id%";
    $rules = $wp_rewrite->generate_rewrite_rule($structure);

    return ($rules + $rewrite);

    creates proper rules in $wp_rewrite object and they work but varible $_REQUEST['lp_lang_view'] is not set:( Is it bug? Do you know any workaround?

  2. sgwood
    Posted 10 years ago #

    Not sure, if this is on the same topic but I am
    trying to use polyglot rewrite as described in
    the polyglot.php, i.e.:
    RewriteRule ^(.*)/xx/?$ /$1?lp_lang_view=xx [QSA]

    I have added:
    RewriteRule ^(.*)/de/?$ /$1?lp_lang_view=de [QSA]e
    to my .htaccess.
    However it doesn't seem to rewrite the 'deutsch' language link.

    I am using the standard Permalink Structure:

    thanks for any help.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.