Why don’t WordPress post slugs allow accents?

The sanitize_title() function uses remove_accents() right away. Both of these functions date way back to <= v1.2.1. The remove_accents() function is a hard coded list of accent characters to explicitly replace a handful of characters in a few specific languages. The inline comment and function reference simply say: Converts all accent characters to ASCII characters. … Read more

Post titles not letting me use 2 consecutive dashes in permalink

Regarding the why part, I think I’ve traced this to the following line: $title = preg_replace(‘|-+|’, ‘-‘, $title); within the sanitize_title_with_dashes() function. It’s added to the santize_title() via the filter: add_filter( ‘sanitize_title’, ‘sanitize_title_with_dashes’, 10, 3 ); but I wouldn’t recommend removing it totally. Update: Here’s a quick and dirty way around this: add_filter( ‘sanitize_title’, function( … Read more

‘post_type_link’ filter not working

It is not a bug. As @LuisSanz pointed out, post_type_link isn’t used for the built-in post post type. It is used for custom post types only. Skim through get_permalink() function, you will find out that WordPress doesn’t use post_type_link filter but uses post_link filter. It means that you’re using wrong filter. Then, change post_type_link to … Read more

Change permalinks structure for specific category

This can be accomplished with some custom filters & actions. Try placing this code in your theme’s functions.php file: add_filter( ‘post_link’, ‘custom_permalink’, 10, 3 ); function custom_permalink( $permalink, $post, $leavename ) { // Get the categories for the post $category = get_the_category($post->ID); if ( !empty($category) && $category[0]->cat_name == “News” ) { $permalink = trailingslashit( home_url(“https://wordpress.stackexchange.com/”. … Read more

URL rewrite based on a custom field value

here is an idea, first add lid to query_vars: add_filter(‘query_vars’, ‘lid_query_vars’); function lid_query_vars($vars) { // add lid to the valid list of variables $new_vars = array(‘lid’); $vars = $new_vars + $vars; return $vars; } then use parse_request hook to create your redirect add_action(‘parse_request’, ‘lid_parse_request’); function lid_parse_request($wp) { // only process requests with “lid” if (array_key_exists(‘lid’, … Read more

Permalinks to Custom does not work (out of box)

Sounds like to that the Allow Override directive is still set to NONE for your VHOST By default this is disabled, so even if you enable mod_rewrite via sudo a2enmod rewrite your .htaccess will be ignored. You’ll want to login to your server (via Terminal / shell) and then … sudo nano /etc/apache2/sites-available/default look through … Read more

How to custom change author base without $this->front?

You’re close, but you don’t need the add_rewrite_rule call. add_action(‘init’, ‘wpse82004_init’); function wpse82004_init() { global $wp_rewrite; $wp_rewrite->author_base=”u”; $wp_rewrite->author_structure=”https://wordpress.stackexchange.com/” . $wp_rewrite->author_base . ‘/%author%’; } After that’s in place, just re-save permalinks. Here’s a plugin to put an option on your permalinks page to do this.

Is there a user-facing interface to edit an attachment’s permalink?

This’ll add a slug field to the edit attachment page, which’ll allow you to independently change it when and how you choose to. Drop it into a plugin or your theme’s functions.php; function wpse_12405_edit_attachment_name( $fields, $post ) { $fields[‘post_name’] = array( ‘label’ => __( ‘Slug’ ), ‘value’ => $post->post_name, ); return $fields; } add_filter( ‘attachment_fields_to_edit’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)