Last active
June 27, 2019 07:18
-
-
Save alt-karate/7f7c45107f7e10995d4f54a6d5ba841a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* スラッグの日本語禁止します | |
*/ | |
function auto_post_slug( $slug, $post_ID, $post_status, $post_type ) { | |
if ( preg_match( '/(%[0-9a-f]{2})+/', $slug ) ) { | |
$slug = utf8_uri_encode( $post_type ) . '-' . $post_ID; | |
} | |
return $slug; | |
} | |
add_filter( 'wp_unique_post_slug', 'auto_post_slug', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment