WordPress.com VIP platform specific
This document is for sites running on WordPress.com VIP.
Permalinks are the permanent URLs to posts, categories, and other sections of your website. They generally look like this by default:
URLs should be permanent and never change — hence the name permalink. When you’re first configuring your site though, you can modify them from the default structure. Some of the values you can use include:
|%year%||The year of the post, four digits, for example 2004|
|%monthnum%||Month of the year, for example 05|
|%day%||Day of the month, for example 28|
|%hour%||Hour of the day, for example 15|
|%minute%||Minute of the hour, for example 43|
|%second%||Second of the minute, for example 33|
|%post_id%||The unique ID # of the post, for example 423|
|%postname%||A sanitized version of the title of the post (post slug field on Edit Post/Page panel). So “This Is A Great Post!” becomes this-is-a-great-post in the URI.|
|%category%||A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI.|
For WordPress.com VIP clients, if you’d like to customize these permastructs, you can use any of the following helper functions in your theme’s functions.php file:
/** * Enable a custom permastruct, if the site wants to use one that's not the WP.com default (/yyyy/mm/dd/post-name/) */ wpcom_vip_load_permastruct( '/%category%/%postname%/' ); /** * Enables a custom or no category base, if the site wants to use one that's not the WP.com default (/category/) */ wpcom_vip_load_category_base( 'section' ); /** * Enables a custom or no tag base, if the site wants to use one that's not the WP.com default (/tag/) */ wpcom_vip_load_tag_base( 'topic' );
If you need to test this in a local environment, instead use the
wp rewrite structure command from WP CLI.
Your theme’s rewrite rules are flushed automatically on every deploy (and when you switch themes), so you only need to worry about committing this change to the repository.
Custom rewrite rules can also be committed to your theme and incorporated in this manner.
There is no need to ever call flush_rewrite_rules() on WordPress VIP.
Rewrite Rules Inspector #
A handy tool for testing and debugging your permastructs is the rewrite rules inspector. Enabled by default on WordPress.com VIP, this plugin features a complete list of your rules and a URL-matching tool to test your URLs. To find the inspector, visit VIP -> rewrite rules.
Note: if the inspector ever shows all or some of your rules in red and issues the “some rules are missing” error, click the flush rules button, and your rules should fully refresh.