Skip to content

Instantly share code, notes, and snippets.

@ka2n
Created November 29, 2012 04:10
Show Gist options
  • Save ka2n/4166772 to your computer and use it in GitHub Desktop.
Save ka2n/4166772 to your computer and use it in GitHub Desktop.
MT Style Post Name
<?php
/*
* Plugin Name: MT Style Post Name
* Description: タイトルから英数字、ダッシュ、アンダーバーのみ抜き取ってスラッグに。日本語しか使われてないエントリはPost_IDを使う。
* Author: 449
* Plugin URI: http://pc10.2ch.net/test/read.cgi/blog/1163599919
* Version: 0.1
* */
add_filter('sanitize_title','sanitize_title_numalpha_only',9);
function sanitize_title_numalpha_only($title) {
return preg_replace('/[^%a-zA-Z0-9 \(\)_-]/', '-', $title);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment