How to use first tag in permalinks

Use add_rewrite_tag() to register the placeholder, and filter post_link to insert the correct tag. Use get_the_tags() to get the tags for a post. Sample plugin I have used in a project: <?php /** * Plugin Name: T5 Tag as rewrite tag * Description: Use <code>%tag%</code> in permalinks. * Version: 2012.09.02 * Author: Thomas Scholz * … Read more

flexible rewrite ‘ramble’ URLs with WordPress

You shouldn’t use the htaccess instead you should use the WordPress APIs e.g. function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘archives/(\d+)(?:/.*)+’ => ‘index.php?p=’. $wp_rewrite->preg_index(1) ); // ( array merge must be done this way, to ensure new rule comes first ) $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // refresh/flush permalinks in the dashboard if … Read more

404 on category.php pagination

Thanks to this and this i was able to adapt the solution to my problem. Solution: add_action( ‘init’, ‘wpa58471_category_base’ ); function wpa58471_category_base() { add_rewrite_rule( ‘blog/([^/]+)/page/(\d+)/?$’, ‘index.php?category_name=$matches[1]&paged=$matches[2]’, ‘top’ ); add_rewrite_rule( ‘blog/([^/]+)/(feed|rdf|rss|rss2|atom)/?$’, ‘index.php?category_name=$matches[1]&feed=$matches[2]’, ‘top’ ); }

Change the url of Projects in Divi Theme

For the taxonomies (like category or any other custom taxonomies, registered for the custom post type, using register_taxonomy function ), to be part of single post permalinks in wordpress, you may use the following code in your functions.php of the current theme: function my_post_type_link( $post_link, $post ){ if( !empty( $post->post_type ) && in_array( $post->post_type, array( … Read more

Performance and styles not working fine after changing permalink structure

Your .htaccess should not be modified on the WordPress part, so it should always be: # 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] </IfModule> # END WordPress It looks like if you have your WordPress install in a Subdirectory of … Read more

Custom permalinks – post type – hierarchical taxonomy’s

Thanks for referencing my solution. You forgot one part though – defining the rewrite of your cpt. From my solution: First get your slugs right when defining your custom post types and taxonomies: for the custom post type it should be basename/%taxonomy_name% and the slug for your taxonomy should be just basename. Dont forget to … Read more