Custom rewrite rules are sending everything to index.php

Finally figured it out. 1) I was calling the first function at ‘rewrite_rules_array’ instead of ‘init’ which was just dumb. 2) There was still something wrong with it, but I explored another area that seems obvious now, but which I originally glossed over because it seemed to be. https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint https://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/ Just make an endpoint. WordPress … Read more

WordPress URL rewrite regex

From the wordpress documentations – https://codex.wordpress.org/Using_Permalinks Using %category% with multiple categories on a post When you assign multiple categories to a post, only one can show up in the permalink. The categories are ordered alphabetically. In each group of sub-categories the order will also be alphabetical. (see Manage Categories). The post will still be accessible … Read more

When to call `add_rewrite_rule` for safety

The easiest solution to this is to hook your add calls on to the last action which gets fired before the rules are rebuilt during the flush process. The first part of the flushing process is to delete the rewrite_rules option. When this happening the following actions will fire: do_action( ‘delete_option’, $option ); do_action( “delete_option_$option”, … Read more

How do I remove a word from a url in WordPress using .htaccess?

You can add the following to your .htaccess file in between the <IfModule mod_rewrite.c> tags: RewriteCond %{HTTP_HOST} RewriteRule ^our-focus/(.*)$ /focus/$1 [R=301,L] Your .htaccess should looks like the following: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # Custom Rewrite RewriteCond … Read more

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