ID && $post->post_name != '' ) { return $slug; } $stopwordsserialized = get_option('slugstopwords'); $stopwordsArray = array(); if( $stopwordsserialized != '' ) $stopwordsArray = unserialize( $stopwordsserialized ); $slugArray = explode( "-", $slug ); $slugArray = array_diff( $slugArray, $stopwordsArray ); $slug = implode( "-", $slugArray ); while( strpos( $slug, "--" ) !== false ) $slug = str_replace( "--", "-", $slug ); if( substr( $slug, 0, 1 ) == "-" ) $slug = substr( $slug, 1 ); if( substr( $slug, -1, 1 ) == "-" ) $slug = substr( $slug, 0, strlen($slug) -1 ); return $slug; } // Options hook function add_remove_stopwords_from_slug_options_page() { if (function_exists('add_options_page')) { add_options_page('Slug Stopwords', 'Slug Stopwords', 10, 'slugstopwords', 'remove_stopwords_from_slug_options_subpanel'); } } // Options panel and form processing function remove_stopwords_from_slug_options_subpanel() { if (isset($_POST['slugstopwords'])) { $slugstopwords = $_POST['slugstopwords']; $slugstopwordsArray = explode( ",", $slugstopwords ); $newslugstopwordsArray = array(); foreach( $slugstopwordsArray as $stopword ) { $stopword = trim( $stopword ); if( $stopword != '' ) $newslugstopwordsArray[] = $stopword; } $slugstopwords = serialize( $newslugstopwordsArray ); update_option('slugstopwords', $slugstopwords); } ?>