Reject all malicious URL requests functions.php

All publicly visible sites on the internet get hit with ridiculous URL requests fairly often. These come from script kiddies (low-rent cybercriminals, the kind of children who think they’re l33t or something) trying to get your site to misbehave and give them access using (mostly) old tricks that exploit long-fixed bugs. Some of the tricks … Read more

Add more user roles to a PHP logout redirect function [closed]

All you have to do is copy the part in the code that checks which role the user has and redirect somewhere else, like this: function redirect_after_logout( $user_id ) { $current_user = get_user_by( ‘id’, $user_id ); $role_name = $current_user->roles[0]; if( $role_name == ‘administrator’ ) { wp_safe_redirect( site_url( ‘/login/’ ) ); exit; } if( $role_name == … Read more

Obfuscate links (for SEO purpose) [closed]

I ended up making my own system that allows me to obfuscate any link easily. Add the following code to your child theme’s functions.php file, then just add the class “obfuscate” to any element to obfuscate its link by replacing it with a element with no readable link. Also be sure to edit styles above, … Read more