`query_var` values empty in theme file after `add_rewrite_rule` redirection

Changing the add_rewrite_rule did the trick: add_rewrite_rule(‘^periodicals/([^/]+)-‘.$tlv[‘code’].'[/]?$’, ‘index.php?periodicals=$matches[1]&post_type=periodicals&name=$matches[1]&mlang=’.$tlv[‘code’], ‘top’); So, I assume for custom post types, using add_rewrite_rule with index.php as query need some extra query variables. A sample will be as: add_rewrite_rule(‘^<custom_post_type>/([^/]+)-‘.$tlv[‘code’].'[/]?$’, ‘index.php?<custom_post_type>=$matches[1]&post_type=<custom_post_type>&name=$matches[1]&mlang=’.$tlv[‘code’], ‘top’);

Remove date rewrite rule for custom post type archive page

You have just a little mistake in your preg_match, instead of this: if ( preg_match(‘/(year=\$matches|monthnum=\$matches)/’, $rewrite) ) { do this: if ( preg_match(‘/(year=\$matches|monthnum=\$matches\/)/’, $rewrite) ) { I was looking for a solution to clean a lot of rules, this source is useful: https://wpreset.com/remove-default-wordpress-rewrite-rules-permalinks/ My final code is this, it can be customized allowing more or … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)