Clean up permalink save function

This commit is contained in:
Brian Miyaji
2014-03-28 11:24:58 +11:00
parent 21eea403aa
commit 51a7f809d6
3 changed files with 8 additions and 11 deletions

View File

@@ -82,10 +82,12 @@ class SP_Admin_Permalink_Settings {
if ( ! is_admin() )
return;
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) && isset( $_POST['product_permalink'] ) ):
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['sportspress_events_slug'] ) ):
foreach ( $this->slugs as $slug ):
$key = 'sportspress_' . $slug[0] . '_slug';
$value = sanitize_text_field( $_POST[ $key ] );
$value = null;
if ( isset( $_POST[ $key ] ) )
$value = sanitize_text_field( $_POST[ $key ] );
if ( empty( $value ) )
delete_option( $key );
else