Rewrite rule not working, issue may be in URI request

I think you should do something like this: function my_rewrite_rule() { add_rewrite_rule(‘^prefix/section/([0-9]+)/([^/]*)?’, ‘index.php?section=$matches[1]&name=$matches[2]&post_type=post’, ‘top’); } add_action(‘init’, ‘my_rewrite_rule’); Add a query var for section: function my_query_vars( $vars ) { $vars[] = ‘section’; return $vars; } add_action( ‘query_vars’, ‘my_query_vars’ ); I created the pattern for your section (which can be 1 or 2) and used $matches[2] to … Read more

WordPress add_rewrite_rule with 2 variables

After lots of pulling my hair out I figured out the problem. I needed to use the add_rewrite_tag() function to tell wordpress to allow my query vars. function prefix_movie_rewrite_rule() { add_rewrite_tag(‘%state_id%’, ‘([A-Za-z0-9\-\_]+)’); add_rewrite_tag(‘%state%’, ‘([A-Za-z0-9\-\_]+)’); add_rewrite_rule ( ‘states/([A-Za-z0-9\-\_]+)/([A-Za-z0-9\-\_]+)’, ‘index.php? state_id=$matches[1]&state=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘prefix_movie_rewrite_rule’);

add_rewrite_rule only works when flush first

Problem with rules occurs, because rule for a given projecttype is added when you visit relevant URL. Every time you visit one of projects/{projectstype}/ addresses and flush rewrite rules, they are deleted and only one rule (only for current project type) is saved/created. You can add your code to request filter hook, then there is … Read more

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