How to secure WordPress? .htaccess, wp-config configuration, Google Analytics 4 and GSC. Site speed and Core Web Vitals.
EN

WordPress security & performance – Complete administrator guide 2025

5.00 /5 - (31 votes )
Last verified: March 1, 2026
Experience: 10+ years experience
Table of Contents

Running a professional WordPress site is more than writing content. It’s continuous work on three pillars: Security, Visibility (Analytics/SEO) and Performance. This article expands on training presentations, collecting best practices used by professional administrators and developers in 2025.

Part 1: Security (hardening)

Many people think expensive “Security Pro” plugins are needed to secure WordPress. That’s a myth. The best protections work at server level, before hackers even touch WordPress files.

1. Digital hygiene

  • Updates: It’s obvious, but 60% of hacked sites are outdated. Using old PHP (7.x)? You’re a target. Update to PHP 8.2 or 8.3 on your server.
  • Themes and Plugins: Delete (not just deactivate) everything you don’t use. Every file on the server is a potential attack vector.
  • Source: Never download “Premium for free” plugins from torrents (Nulled). They’re trojans 99% of the time.

2. Configuration security (wp-config.php)

Add these lines to your config file to block typical attacks:

// Block file editing from admin
define( 'DISALLOW_FILE_EDIT', true );

// Force SSL for login and panel
define( 'FORCE_SSL_ADMIN', true );

// Change database prefix (do this ONLY during installation!)
$table_prefix = 'wp_a1b2_'; // Instead of default wp_

3. Firewall (.htaccess)

The .htaccess file (on Apache/LiteSpeed servers) is your first guard.

  • Block access to sensitive files:
    <FilesMatch "(^\.|wp-config\.php|xmlrpc\.php)">
    Order deny,allow
    Deny from all
    </FilesMatch>

Part 2: Analytics and webmaster tools

You can’t manage what you don’t measure. Google Search Console (GSC) and Google Analytics 4 (GA4) are your business’s eyes and ears.

Google search console (gsc)

The only place where Google “talks” to you about your site.

  1. Sitemap: Make sure you’ve submitted your sitemap (usually domain.com/sitemap_index.xml generated by SEO framework).
  2. Indexing Errors: Check the “Pages” section weekly. Look for 404 (not found) and 5xx (server errors). Every error is a lost customer.
  3. Core Web Vitals: GSC will tell you directly if your site is fast enough (LCP) and visually stable (CLS).

Google analytics 4

GA4 differs from old UA. It focuses on events.

  • Don’t just measure “visits”. Configure conversions: form submission, phone click, PDF download.
  • Remember GDPR. Use “Consent Mode v2” to collect data legally.

Part 3: Optimization (wpo)

A fast site means higher Google rankings and higher conversion.

1. Hosting is fundamental

You can’t optimize a site on hosting for $5/year. Look for hosting with:

  • NVMe disks (10x faster than SSD).
  • Redis/Memcached support (database in RAM).
  • LiteSpeed (LSCache) or Nginx server.

2. Images

Photos are 80% of page weight.

  • Lazy Loading: WordPress does this by default, but optimization plugins do it better.
  • Formats: Use WebP or AVIF. They’re 30-50% lighter than JPG at the same quality.
  • Dimensions: Don’t upload 4000px photos to a blog where text width is 800px.

3. Caching

Your site shouldn’t generate PHP for every visitor.

  • Page Cache: Saves ready HTML to server disk.
  • Object Cache (Redis): Saves SQL query results. Crucial for WooCommerce stores and large sites.

Summary

Looking after a WordPress site is a process, not a one-time action.

  • Daily: Check backups (automatic).
  • Weekly: Update plugins and check GSC.
  • Monthly: Do speed audit and user review (does anyone unauthorized have admin access?).

Only this approach guarantees peace of mind and stable business growth.

Do I need expensive security plugins for WordPress?
No. The best protections work at the server level via .htaccess and wp-config.php, before hackers even touch WordPress files. Plugins are useful but not essential for basic security.
What are the most important wp-config.php settings for security?
Key settings: DISALLOW_FILE_EDIT (blocks file editing from admin), FORCE_SSL_ADMIN (forces SSL for login), changing $table_prefix from default 'wp_' to custom prefix.
Why are updates so important for WordPress security?
60% of hacked sites are outdated. Old PHP versions (7.x), outdated plugins and themes contain known vulnerabilities that hackers actively exploit.
Are 'Premium for free' plugins from torrents safe?
Absolutely not. 99% of the time they are trojans. Always download plugins from the official WordPress repository or directly from the author.
How can I speed up WordPress without changing hosting?
Update to PHP 8.2/8.3, implement object caching (Redis), optimize images (WebP/AVIF), remove unused plugins and themes, minimize third-party scripts.

Need an FAQ tailored to your industry and market? We can build one aligned with your business goals.

Let’s discuss

Related Articles