ADVERTISEMENT

Wordpress Security 101

Published Oct 5, 2020 02:44 pm

WordPress is one of the most popular Content Management System (CMS) on the market and perhaps unsurprisingly, the most hacked. WordPress powers over one-third of the web! That means there are currently over 75 million websites that use WordPress.

Getting Hacked can be a real pain. A simple mistake can damage your business reputation and put your customers and their data at risk.

There Is No Such Thing As ‘Unhackable’ 

You might say: "My website does not contain any valuable and sensitive business information so it won't be hacked."

You’re wrong.

There are still plenty of reasons why your website will be hacked.

1.) Black-hat Search Engine Optimization (SEO)
2.) Spread Malwares
3.) Just for fun
4.) Hacktivism

How do I secure my website?

Website Security should be taken seriously; issues may appear if some basic security precautions aren’t taken. This mindset prompts you to continue taking steps to improve your security as part of an ongoing, never-ending initiative.

1.) Disable file editing - If a hacker obtains Admin Access to your WordPress website, he won't be able to edit any files that are part of your website. This includes all plugins and themes.

Add the Following lines to your wp-config.php

define('DISALLOW_FILE_EDIT', true);

2.) Disable directory listing - A directory listing provides an attacker with the complete index of all the resources located inside of the directory. The specific risks and consequences vary depending on which files are listed and accessible.

You can prevent this by adding the following line of code in your .htaccess file:

Options All -Indexes

3.) Use two-factor authentication - Using Two-Factor Authentication is a good security measure, in a case where the hacker was able to get working credentials but he won't be able to login since the second step requires you to authenticate using a separate device or app:

https://wordpress.org/plugins/miniorange-2-factor-authentication/

4.) Always Backup - Backing up your site is about creating a copy of all the site’s data, and storing it somewhere safe. That way, you can restore the site from that backup copy in case anything bad happens.

5.) Install a Security Plugin - A security plugin takes care of your site security, scans for malware and monitors your site 24/7 to regularly check what is happening on your site.

Wordfence does a great job in this regard, and it’s one of the best security services for WordPress out here. It kind of does a bit of everything.

6.) Always Update - Keeping your wordpress instance up to date is a good security practice to maintain. With every update, developers make a few changes, oftentimes including updates to security features. It is also important to update your plugins and themes for the same reasons.

7.) Use Strong Password - This is your first defense against brute force attacks.  A weak password never fares well against a brute force attack.

8.) Delete Unused Plugins/themes - Unused or inactive themes and plugins pose a serious threat to your WordPress website. Plugins and Themes that are not in use should be deleted immediately.

9.) Securing wp-config.php - The Configuration file contains sensitive information about the database, including name, host, username, password and Salts & Keys.

This .htaccess rule will make your wp-config.php inaccessible by anyone.

order allow,deny
deny from all

10.) Set Correct Permissions - Make sure your permission is as follows:

Folders – 755
Files – 644


You should never set any WordPress file or directory to 777 permissions.

Ending Thoughts
By Following the steps above you’ve just protected yourself from the most common Threats. This is an Ongoing process that needs continuous attention. Keep in mind that You are never done with security.

ADVERTISEMENT
.most-popular .layout-ratio{ padding-bottom: 79.13%; } @media (min-width: 768px) and (max-width: 1024px) { .widget-title { font-size: 15px !important; } }

{{ articles_filter_1561_widget.title }}

.most-popular .layout-ratio{ padding-bottom: 79.13%; } @media (min-width: 768px) and (max-width: 1024px) { .widget-title { font-size: 15px !important; } }

{{ articles_filter_1562_widget.title }}

.most-popular .layout-ratio{ padding-bottom: 79.13%; } @media (min-width: 768px) and (max-width: 1024px) { .widget-title { font-size: 15px !important; } }

{{ articles_filter_1563_widget.title }}

{{ articles_filter_1564_widget.title }}

.mb-article-details { position: relative; } .mb-article-details .article-body-preview, .mb-article-details .article-body-summary{ font-size: 17px; line-height: 30px; font-family: "Libre Caslon Text", serif; color: #000; } .mb-article-details .article-body-preview iframe , .mb-article-details .article-body-summary iframe{ width: 100%; margin: auto; } .read-more-background { background: linear-gradient(180deg, color(display-p3 1.000 1.000 1.000 / 0) 13.75%, color(display-p3 1.000 1.000 1.000 / 0.8) 30.79%, color(display-p3 1.000 1.000 1.000) 72.5%); position: absolute; height: 200px; width: 100%; bottom: 0; display: flex; justify-content: center; align-items: center; padding: 0; } .read-more-background a{ color: #000; } .read-more-btn { padding: 17px 45px; font-family: Inter; font-weight: 700; font-size: 18px; line-height: 16px; text-align: center; vertical-align: middle; border: 1px solid black; background-color: white; } .hidden { display: none; }
function initializeAllSwipers() { // Get all hidden inputs with cms_article_id document.querySelectorAll('[id^="cms_article_id_"]').forEach(function (input) { const cmsArticleId = input.value; const articleSelector = '#article-' + cmsArticleId + ' .body_images'; const swiperElement = document.querySelector(articleSelector); if (swiperElement && !swiperElement.classList.contains('swiper-initialized')) { new Swiper(articleSelector, { loop: true, pagination: false, navigation: { nextEl: '#article-' + cmsArticleId + ' .swiper-button-next', prevEl: '#article-' + cmsArticleId + ' .swiper-button-prev', }, }); } }); } setTimeout(initializeAllSwipers, 3000); const intersectionObserver = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { const newUrl = entry.target.getAttribute("data-url"); if (newUrl) { history.pushState(null, null, newUrl); let article = entry.target; // Extract metadata const author = article.querySelector('.author-section').textContent.replace('By', '').trim(); const section = article.querySelector('.section-info ').textContent.replace(' ', ' '); const title = article.querySelector('.article-title h1').textContent; // Parse URL for Chartbeat path format const parsedUrl = new URL(newUrl, window.location.origin); const cleanUrl = parsedUrl.host + parsedUrl.pathname; // Update Chartbeat configuration if (typeof window._sf_async_config !== 'undefined') { window._sf_async_config.path = cleanUrl; window._sf_async_config.sections = section; window._sf_async_config.authors = author; } // Track virtual page view with Chartbeat if (typeof pSUPERFLY !== 'undefined' && typeof pSUPERFLY.virtualPage === 'function') { try { pSUPERFLY.virtualPage({ path: cleanUrl, title: title, sections: section, authors: author }); } catch (error) { console.error('ping error', error); } } // Optional: Update document title if (title && title !== document.title) { document.title = title; } } } }); }, { threshold: 0.1 } ); function showArticleBody(button) { const article = button.closest("article"); const summary = article.querySelector(".article-body-summary"); const body = article.querySelector(".article-body-preview"); const readMoreSection = article.querySelector(".read-more-background"); // Hide summary and read-more section summary.style.display = "none"; readMoreSection.style.display = "none"; // Show the full article body body.classList.remove("hidden"); } document.addEventListener("DOMContentLoaded", () => { let loadCount = 0; // Track how many times articles are loaded const offset = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; // Offset values const currentUrl = window.location.pathname.substring(1); let isLoading = false; // Prevent multiple calls if (!currentUrl) { console.log("Current URL is invalid."); return; } const sentinel = document.getElementById("load-more-sentinel"); if (!sentinel) { console.log("Sentinel element not found."); return; } function isSentinelVisible() { const rect = sentinel.getBoundingClientRect(); return ( rect.top < window.innerHeight && rect.bottom >= 0 ); } function onScroll() { if (isLoading) return; if (isSentinelVisible()) { if (loadCount >= offset.length) { console.log("Maximum load attempts reached."); window.removeEventListener("scroll", onScroll); return; } isLoading = true; const currentOffset = offset[loadCount]; window.loadMoreItems().then(() => { let article = document.querySelector('#widget_1690 > div:nth-last-of-type(2) article'); intersectionObserver.observe(article) loadCount++; }).catch(error => { console.error("Error loading more items:", error); }).finally(() => { isLoading = false; }); } } window.addEventListener("scroll", onScroll); });

Sign up by email to receive news.