Force/Limit the post/page slug to accept only url friendly characters

For now I used the sanitize_title filter, and removed all unwanted characters, which forces my users to use only [a-z0-9-] as a valid input for titles. ## Allow only [a-z0-9-] in the slug function my_clear_title($title) { $pattern = ‘/[^a-z_0-9- ]/i’; $replace_with=””; return preg_replace($pattern, $replace_with, $title); } add_filter(‘sanitize_title’, ‘my_clear_title’, 3, 1); I had to use a … Read more

Creating plugin for changing slug

You can change the slug as you want in wordpress. Just go to the post or to the page. Edit the Post or the Page you want to change the slug. On the right side there is a button: Screen Options. Click it and Check slug. Then you’ll manually can give what ever slug you … Read more

Category Name and Slug field need to be the same otherwise it breaks category pages

I can’t comment yet, but I can answer – I think your problem may be that you’ve declared your $terms variable twice in your code, within your loop: <?php $terms = get_the_terms( $post->id, ‘knowledgebase_types’ ); ?> and <?php $terms = get_the_terms( $post->post_id, ‘knowledgebase_topics’ );?> Though some more information about what result you are actually seeing … Read more

How to add 2 variable rewrite rule?

You’ll need to write a rewrite rule to parse the URL and pull out the value of gallery-name and gallery-item-name. This will be tricky as there is nothing to distinguish your proposed URL structure from a hierarchical page structure. If you can throw in something that is always the same for all gallery URLs like … Read more

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