Skip to content

Remove Non-Breaking Space and !important from Custom Field Output in S2Member Profiles

…because the S2Member generation of field html includes inline “!important” codes that make them impossible to style via CSS, and because the checkbox output includes non-breaking spaces that also impede re-styling.

/**
 * Remove Non-Breaking Space ( ) and !important from Custom Field 
 * Output in S2Member Profiles
 **/


/* S2 MEMBER CHECKBOX FIELD OUTPUT */

add_filter( 'ws_plugin__s2member_custom_field_gen_checkboxes_sep', 'replace_nbsp_checkbox' ) ;

function replace_nbsp_checkbox( $sep ) {
	
	return '' ;
	
}

/* MAKE S2 MEMBER CUSTOM FIELD INLINE CSS STYLE-ABLE */

add_filter( 'ws_plugin__s2member_custom_field_gen', 'remove_all_importants' ) ;

function remove_all_importants( $gen ) {
	
	return str_replace( '!important', '', $gen ) ;

}

Leave a Reply