Multiple values in a rewrite rule, is it possible?

As far I understand, you know are able to have an URL like example.com/recipes/dinner/ or example.com/recipes/lunch/ but now you also want to have an URL like example.com/recipes/dinner-lunch/ that pulls posts from both “dinner” and “lunch” courses. In currents state of WP rewrites this is not possible just with add_rewrite_rule but you also need to use … Read more

Rewrite rule never matching

Please try this. First add the rewrite rule you need with this function add_action( ‘init’, ‘rewrite_site_tools_page’ ); function rewrite_site_tools_page() { add_rewrite_rule( ‘^site-tools-([^/]+)$’, ‘index.php?pagename=site-tools&tool=$matches[1]’, ‘top’); } Assuming that page name is site-tools. Now add the tool as query var add_filter(‘query_vars’, ‘wpd_query_vars’); function wpd_query_vars( $query_vars ){ $query_vars[] = ‘tool’; return $query_vars; } Save permalinks. Now if you … Read more

resolve /author/ to a page or archive (of all authors) template

If you use code similar to setup the rewrite rules: function ex_rewrite( $wp_rewrite ) { $feed_rules = array( ‘author/?$’ => ‘index.php?author_page=author_page’ ); $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; return $wp_rewrite; } // refresh/flush permalinks in the dashboard if this is changed in any way add_filter( ‘generate_rewrite_rules’, ‘ex_rewrite’ ); followed by code to add the author_page as … Read more

Rewrite rules in multisite

Found the answers: There is nothing to do when using the Rewrite API that isn’t written in the Codex. Rules written using add_rewrite_rule are not added to .htaccess. WP adds them to its database under rewrite_rules in the _options table. It’s important not to forget to: Filter the rewritten permalinks; call the functions on the … Read more

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