Remove some rewrite rules in wordpress

You can modify the global WP_Rewrite variable directly. add_action(‘init’, function(){ global $wp_rewrite; echo “<pre>”; var_dump($wp_rewrite); wp_die(); }); There are sevel properties you can adjust: $wp_rewrite->permalink_structure $wp_rewrite->use_trailing_slashes $wp_rewrite->author_base $wp_rewrite->search_base $wp_rewrite->comments_base $wp_rewrite->pagination_base $wp_rewrite->comments_pagination_base $wp_rewrite->feed_base $wp_rewrite->front $wp_rewrite->root $wp_rewrite->index $wp_rewrite->matches $wp_rewrite->rules $wp_rewrite->extra_rules $wp_rewrite->extra_rules_top $wp_rewrite->non_wp_rules $wp_rewrite->extra_permastructs $wp_rewrite->endpoints $wp_rewrite->use_verbose_rules $wp_rewrite->use_verbose_page_rules $wp_rewrite->rewritecode $wp_rewrite->rewritereplace $wp_rewrite->queryreplace $wp_rewrite->feeds And alternate removal functions: $wp_rewrite->remove_permastruct $wp_rewrite->remove_rewrite_tag

website with pretty permalinks except pagination

WP permalink handling is sort of layered. They underlying “ugly” permalinks capture the actual logic of the system and the “pretty” permalinks are just cosmetic enhancement on top of it. Even when pretty permalinks are enabled, the original ugly permalinks still continue to work. But under normal circumstances they get redirected to a pretty version. … Read more

show ALL latest posts with archive.php on example.com/latest

All internal rules must point to index.php. This isn’t your theme’s index.php file, this is the main core WordPress bootstrap file. Rewrite rules set query vars, query vars get parsed into queries, those queries have template files associated with them depending on type. Internal rewrite rules never point directly to theme files. If you want … Read more

Rewrite without query parameter

The wordpress “rewrite rules” have a horrible name which do not match what people are expecting it to be. Those are not rules to rewrite or redirect or whatever other things you can do with htaccess, but rules which are used to “rewrite” urls into the relevant WP_Query parameters. Therefor if you have a rewrite … Read more

Custom Rewrite Rule for Custom Post Type with URL Param

SOLUTION: I am answering my own question here since no responses were given and I presume this might be helpful to someone and in the mean while I found a solution.. I had to use the second version of ‘add_rewrite_rule’: add_rewrite_rule( ‘^products/directory/?([^/]*)/?’, ‘index.php?post_type=acme_product&c=$matches[1]’, ‘top’ ); I needed to register a query var,, since external query … Read more

Is it possible to register a new template file?

I would strongly suggest you use a WordPress page template. At the top of dashboard.php: <?php /** * Template Name: Dashboard */ Now create a page called “Dashboard” and assign it the dashboard template. This way you’re not loading WordPress yourself (nearly always bad) & WordPress & all your plugins will function as normal (creating … Read more

Trouble with question mark in rewrite rule

The root problem here is a misunderstanding of how URLs work. What you see in the browser is not a full URL, but something to make it easier to understand For example, take this URL: http://example.com/test/?foo=bar#bananas Here we have instructions to: Via HTTP protocol aka http:// contact the server at example.com aka https://example.com and do … Read more

Disable WordPress Archive Conflict Check

If you read a little further down past that code you are thinking about commenting out, you will see that right before the function is finished it provides a hook for the result: return apply_filters( ‘wp_unique_post_slug’, $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ); This means you can override what it is doing to your slugs: … Read more

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