updated to samw code that wp plugin