Basic password protection without using users and roles

You could try hooking into template_include and showing the user a completely different page containing the login form (without changing the URL) if the post is password protected. Combine that WordPress’ built in post password functionality and you have something really close to what you want (blocking an entire page). You could also use {{insert … Read more

Security to delete post by Admin

At first, read something about WordPress Ajax API and about Roles and Capabilities – capability to “edit_posts” has even Contributor. I would suggest to check for ‘delete_others_posts’ to prove the user is at least Editor. Or use capability of ‘manage_options’ (has Administrator, not Editor). Further, there is a check ajax referer function for you to … Read more

Separate Out Real Users

If you install the following plugin and leave that one running for a while… you can see who logged in since using that plugin: http://wordpress.org/extend/plugins/wp-last-login/ That seems to do what you need. As far as I quickly can see it runs on $this->hook( ‘wp_login’ ) and does: $user = get_user_by( ‘login’, $user_login ); update_user_meta( $user->ID, … Read more

Security and Must Use Plugins

I agree with Wyck’s comment. If I can upload files, game over. If I couldn’t upload to mu-plugins chances are that I could upload, and overwrite, the theme’s functions.php or Core files instead. Any of those options work as well or better than a mu-plugin file would. The “also modify the database” part is irrelevant … Read more

Is that a malicious code?

That is most likely a false positive : https://en.wikipedia.org/wiki/Type_I_and_type_II_errors base64_decode is not bad in of itself : https://en.wikipedia.org/wiki/Base64 The plugin is not smart enough to know a legitimate reason to use base64_decode of which there are many.

What’s the proper way to sanitize checkbox value sent to the database

I would use the filter_var() function. It has some predefined filters that you can use depending on what kind of data you are expecting such as string, number, etc. So to sanitize for a number: $sanitizedNum = filter_var($yourVar, FILTER_SANITIZE_NUMBER_INT); For a string you would just change “_NUM_INT” to “_STRING”. Wrap those in a custom function … Read more