Data inserted by wpdb insert is different than data pressnt in database.

wpdb::insert will only ensure that data is inserted safely (i.e prevents against SQL injection). It will not sanitize your data (e.g. stripping certain/all HTML), that’s down to you. You can either use wp_strip_all_tags, which removes all HTML, or a variation of wp_kses, which is a sophisticated library for removing certain (x)HTML tags & entitites. The … Read more

Adding another field to user table

It’s easy. Just add function with your options to show_user_profile and edit_user_profile hooks, and save them on personal_options_update and edit_user_profile_update. Like this for instance (you can add your own fields (text, number etc.)) /********* Additional User Content ***********/ add_action( ‘show_user_profile’, ‘mytheme_extra_profile_fields’ ); add_action( ‘edit_user_profile’, ‘mytheme_extra_profile_fields’ ); function mytheme_extra_profile_fields( $user ) { ?> <?php $customData = … Read more

custom wp_editor does not save the content in plugin settings

Might be possible that your wp_editor is broken! According to codex you can not use numeric editor ID may only contain lowercase letters and underscores…hyphens will cause editor to not display properly Call wp_editor in this way wp_editor( $nga_textarea_field_1_invalid, ‘nga_textarea_field_one’ ); textarea_name is not required because by default it is already wp_editor ID. I am … Read more

in_array function Problem

I’d assume that $specific_admin_usernames is an array– so there’s no need for this line $specific_admin_usernames_imploded = implode($master_admin_usernames); Also your if statement is a little backwards. PHP’s in_array( $needle, $haystack) doesn’t need the $current_logged_in_user !== part. Try: if ( in_array($current_logged_in_user, $master_admin_usernames) ){ // this runs when the current user is IN the master list }

Adding Custom CSS with PHP

I know this sounds like it’s a good idea, but anyone can simply just view the source of the page and take whatever they want from there. They can also simply just hit Ctrl+S on their keyboard and save that entire page to their hard drive. They could even screenshot the page and use OCR … Read more