Multisite wordpress and subdomain URL collisions

You could just prevent slugs matching existing directories. There are two filters for that. Example, not tested: add_filter( ‘wp_unique_post_slug_is_bad_hierarchical_slug’, ‘prevent_directory_slugs’, 10, 2 ); add_filter( ‘wp_unique_post_slug_is_bad_flat_slug’, ‘prevent_directory_slugs’, 10, 2 ); function prevent_directory_slugs( $bool, $slug ) { return is_dir( ABSPATH . “https://wordpress.stackexchange.com/” . $slug ); }

Prepend meta_value to permalink of post

In this case it seems like you’ll want to hook into the WordPress rewrite rules. {$permastruct}_rewrite_rules doesn’t have a lot of information, but this filter would allow you modify the array of existing rewrite rules to add in your new rewrite rule for series. For this to work: http://example.com/series/movie_slug/parrent_series_slug/series_slug You’ll need to add in movie_slug, … Read more

nginx – permalinks with .php in url not working

I ended up changing location ~ ^/.*\.php$ { try_files $uri = 404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } to location ~ ^/.*\.php$ { try_files $uri $uri/ /index.php?$args; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } It now works, but I feel that is a security issue now.

Why does WP not use relative links when linking pages?

Your question seems to have been already answered by a user here: https://stackoverflow.com/a/18516783/844732 However it sounds like your problem would be solved by using this plugin: Relative URL Relative URL applies wp_make_link_relative function to links to convert them to relative URLs. Yoast also has some background on relative URLs.

Replace WordPress %postname% suffix with %postid%?

I suppose you could filter wp_unique_post_slug and have it return the original slug for posts, but I’m not sure what kind of side-effects this may have: add_filter( ‘wp_unique_post_slug’, function( $slug, $post_id, $post_status, $post_type, $post_parent, $original_slug ) { if ( $post_type == ‘post’ ) $slug = $original_slug; return $slug; }, 10, 6 ); And here’s how … Read more

Changing Permalinks to a Custom Permalink causes a 404 Error [no matter what I do]

…remove the <IfModule mod_rewrite.c> wrapper? Or include RewriteEngine On at the top of the .htaccess file, above the <IfModule> wrapper? : @MrWhite Tried it, still get a internal error. That indicates that you don’t have mod_rewrite installed on your server or you are not permitted to use mod_rewrite in .htaccess files (see the AllowOverride directives … Read more

Custom permalink structure with a prefix just for posts

There are different ways to achieve this result, I used pre_post_link and post_rewrite_rules filter hooks. You can use eg. generate_rewrite_rules hook, but with post_rewrite_rules, you can easily change permalinks not only to the post but also to its comments, attachments, etc. Original permalinks you can keep or replace with new ones. After adding the following … Read more

Without index.php in permalinks I get 404 across site

Adding junk doesn’t do anything either. That suggests your .htaccess file is not being processed at all. You need to set AllowOverride All in the appropriate <Directory> container in the main server config (or <VirtualHost> container) to enable the parsing of per-directory .htaccess files (to allow .htaccess directives to override the server config). The FollowSymLinks … Read more

Nice URLs for a Custom Post Type List with a Shared Custom Taxonomy?

For the first preference, you’d need to filter in additional rewrite rules like so; function __extra_country_rewrite_rules( $rules ) { global $wp_rewrite; if ( !isset( $wp_rewrite ) ) $wp_rewrite = new WP_Rewrite; $m1 = $wp_rewrite->preg_index(1); // preg match backreferences $m2 = $wp_rewrite->preg_index(2); $m3 = $wp_rewrite->preg_index(3); $rules[‘country/([^/]+)/([^/]+)s/feed/(feed|rdf|rss|rss2|atom)/?$’] = “index.php?country=$m1&post_type=$m2&feed=$m3”; $rules[‘country/([^/]+)/([^/]+)s/(feed|rdf|rss|rss2|atom)/?$’] = “index.php?country=$m1&post_type=$m2&feed=$m3”; $rules[‘country/([^/]+)/([^/]+)s/page/?([0-9]{1,})/?$’] = “index.php?country=$m1&post_type=$m2&paged=$m3”; $rules[‘country/([^/]+)/([^/]+)s/?$’] = … Read more