Why can posts never have a number as the link?

Why Suffixes Are Appended to (Some) Numeric Post-Slugs WordPress posts can almost always have numeric permalinks, the exceptions being when they might conflict with another post, a feed, or a post post-type date archive, or are otherwise reserved. The wp_unique_post_slug() function mitigates these conflicts by appending a suffix. Potential date-archive conflicts arise when a numeric … Read more

Change permalinks in posts via SQL

If you are using MySQL 8 and above you can use REGEXP_REPLACE, e.i. UPDATE `wp_posts` SET post_content=REGEXP_REPLACE(post_content, ‘domain.tld\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/’, ‘domain.tld/’) WHERE post_content REGEXP ‘domain.tld\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/’; this would look for exact match domain.tld/{4 digit int}/{2 digit int}/{2 digit int}/ then replace it with domain.tld/ so it will replace something like domain.tld/2000/01/01/my-cool-post/ to domain.tld/my-cool-post/ Another option if you cannot … Read more

Custom rewrite, url path with parameters to a page

Your code seems to work fine with slight modifications. Taken from here: https://developer.wordpress.org/reference/functions/add_rewrite_rule/#comment-content-4787 First off, I moved the rewrite rules to init and modified the regex to match parameters optionally: function wse_414800_rewrite_state_city() { add_rewrite_rule( ‘^(pluginpage)/([^/]*)/([^/]*)/?’, ‘index.php?pagename=pluginpage&state=$matches[2]&city=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘^(pluginpage)/([^/]*)/?’, ‘index.php?pagename=pluginpage&state=$matches[2]’, ‘top’ ); } add_action(‘init’, ‘wse_414800_rewrite_state_city’); And, to be able to retrieve our custom query … Read more