Rewrite for page with a possible unknown parent page

You can use the pattern (([^/]*)/)? to match a full <component>/ construction – this will create a multi-dimensional element in the $matches array, with the first level containing the full expression and the internal matches containing an item with <component> without the “https://wordpress.stackexchange.com/” character. However, you need to be very careful in the way you … Read more

Font Page overrides rewrites

Are you sure your rewrite rules are actually being saved? How are you calling this function to setup the rewrite rules? Action? What about flushing rewrite rules, are you flushing them anywhere in your project? Disable all of your plugins and test to make sure one isn’t flushing rewrite rules on every page load. As … Read more

Where to hook to bypass instantiating WP_Query?

While it’s possible to get rid of WP_Query in WP load process it’s pretty horribly inconvenient to accomplish. 🙂 Let’s recap the process as related to rewrite: Web server takes pretty permalink and rewrites it to WP’s index.php. WP takes “pretty” part and applies its rewrite rules to it, turning it into query variables. Query … Read more

Why won’t this rewrite rule work?

You have to make your rewrite rules account for the paged parameter, because otherwise they won’t. It would look somewhat like shown below. function test_add_rewrite_rules() { add_rewrite_rule( ‘businesses/(eat|stay|play)/(.+)/page/([0-9]+)/?$’, ‘index.php?post_type=businesses&display_category=$matches[1]&filters=$matches[2]&paged=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘businesses/(eat|stay|play)/page/([0-9]+)/?$’, ‘index.php?post_type=businesses&display_category=$matches[1]&paged=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘test_add_rewrite_rules’ );

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