How to Change Author Posts URL

You can accomplish this with the following rewrite rule ( you’ll want to add this in your functions.php add_rewrite_rule( ‘author/([0-9]+)/?$’, ‘index.php?author=$matches[1]’, ‘top’ ); Be aware that you might need to flush your rules for it to become active. You can do this with rewrite plugin.

Rewrite Rule for Custom Page with Query Vars in URL

I manually deleted the .htaccess file and regenerated, which along with the code below, made the rewrite work. The second rewrite rule in the code below makes the pagination work properly. The .htaccess file doesn’t seem to be getting written with any rules though, but the rewrite is working now anyhow. function listen_rewrite_action() { add_rewrite_tag(‘%show%’,'([^/]*)’); … Read more

Why did installing wordpress in url root jack up underlying WP sites?

In each of the web.config files for each directory, they will look much like this: <rewrite> <rules> <rule name=”wordpress” stopProcessing=”true”> <match url=”*” /> <conditions> <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” /> <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” /> </conditions> <action type=”Rewrite” url=”index.php” /> </rule> </rules> </rewrite> For each sub-site, you need to change the rule name and add a … Read more

Author url rewrite

Assuming you are using custom post types for songs, books etc: function add_rewrite_rules($rules) { $newrules[‘author/([^/]+)/songs/?$’] = ‘index.php?post_type=songs&author=$matches[1]’; $newrules[‘author/([^/]+)/songs/page/?([0-9]{1,})/?$’] = ‘index.php?post_type=songs&locations=$matches[1]&paged=$matches[2]’; $rules = $newrules + $rules; return $rules; } function flushRules() { global $wp_rewrite; $wp_rewrite->flush_rules(); } add_filter(‘rewrite_rules_array’, ‘add_rewrite_rules’); /* This function should only really be run once per change of rules – comment out */ add_filter(‘init’,’flushRules’); … Read more

Changing the category permalink structure

The following code changes all links to category archives so they don’t include the parent category: add_filter( ‘category_link’, ‘wpse7807_category_link’, 10, 2 ); function wpse7807_category_link( $catlink, $category_id ) { global $wp_rewrite; $catlink = $wp_rewrite->get_category_permastruct(); if ( empty( $catlink ) ) { $catlink = home_url(‘?cat=” . $category_id); } else { $category = &get_category( $category_id ); $category_nicename = … Read more

Rewrite custom post type url’s adding meta box values

It sounds like you’re very close here and your only remaining issue is that your permalinks for genres and movies collide. ‘movies’ CPT permalink /genres/%custom field meta box value%/%movie%/ ‘genres’ CPT permalink /genres/%genre%/ The issue here is using the add_permastruct. When it creates the rules for movies, they look something like this: genres/([^/]+)/([^/]+)(/[0-9]+)?/?$ => index.php?genre=$matches[1]&movies=$matches[2]&page=$matches[3] … Read more