Block IP Manually from Fail2Ban Plesk server

While using Fail2Ban under a Plesk handled server, you have a GUI to view the current Banned IP’s, and also “whitelist” IP’s (move to trusted IP’s), But you don’t have the option to manually add an IP to the Blacklist, and permanently block a specific IP. To do so, SSH to your terminal as …


Setting git on a production server

To set your git repo on your production server. go tho the root directory of the server (i.e. public_html or httpdocs etc.) then run: git init run (to connect your server with the cloud repo) git remote add origin https://PATH_TO_YOUR_REPO Then if you want your production server to always pull from the remote origin …


Bitbucket – set remote for a repo

Step 1: Switch to your repository’s directory cd /path/to/your/repo Step 2: Connect your existing repository to Bitbucket git remote add origin https://PATH_TO_YOUR_REPO git push -u origin master


Git – Remove unsaved changes

To remove all changes you made  and “reset” to the last commit # Revert changes to modified files. git reset –hard # Remove all untracked files and directories. (`-f` is `force`, `-d` is `remove directories`) git clean -fd


Git Error – invalid active developer path (also called, did you upgraded to macOS Sierra?)

  If you are getting this error,  error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun This is because you are on a Mac, and you upgraded to macOS Sierra. To fix this, all you need to do is update/install Xcode. run this command in the terminal:   xcode-select –install Run the command, …


WordPress – Get a list of all user roles (existing in the site)

# WordPress – Get a list of all user roles (existing in the site) sometimes you need to see all of the user roles in your website, to do that Add this in functions.php: function get_editable_roles() { global $wp_roles; $all_roles = $wp_roles->roles; $editable_roles = apply_filters(‘editable_roles’, $all_roles); return $editable_roles; } Now, on some page of …


WordPress – Create a custom user role (and delete a role)

# WordPress – Create a custom user role Sometimes you want to create a special user with a special name and behavior inside WordPress The way to add a custom user role is the following: function add_capability() { // Add a custom user role (1) – Let’s say… God! $result = add_role( ‘god’, __(‘God’), …


WP Query Show Post Count when Paginating results

# WP Query Show Post Count when Paginating results Let’s say that you doing a custom query, and their is pagination in place, and you want to show : “Displaying 2 out of 5 results” (2 results on this page, and you have 5 total in all of the pages). The way to do …


WordPress – Change User Role name

# WordPress – Change User Role name in functions.php : function change_role_name() { global $wp_roles; if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); //You can list all currently available roles like this… // This is only for you to see whats going on, after checking, remove these 2 lines altogether $roles …


WordPress – Contact Form 7 – Dynamic change fields

# WordPress – Contact Form 7 – Dynamic change fields yes you can use a plugin “something cf7 dynamic fields”, but their is a better way, or at least let’s call it, my way. We can change the fields via JavaScript on document ready… First of all Give the field an id (in contact …