How to remove WordPress spam users using WP-CLI

If you have a huge amount of spam users in your database you need to check this post https://alltime.pp.ua/blog/how-to-remove-wordpress-spam-users-using-mysql-command-line/ as the way below will take ‘forever’ 🙂

Supposed you’ve decided to leave just ‘administrator’

Using command below you found a pattern

wp user list

So, now run to remove them:

wp user delete $(wp user list --role=author --field=ID)
wp user delete $(wp user list --role=customer --field=ID)
wp user delete $(wp user list --role=subscriber --field=ID)

You should be asked and if you are sure just type ‘y

–reassign parameter not passed.… Read the rest

WordPress Multisite default .htaccess rules

SubFolder Example

WordPress 3.0 through 3.4.2

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)
Read the rest

WordPress enable force SSL over wp-config.php

You will need to edit domain name using the following and append it into your wp-config.php file

define('WP_SITEURL', 'https://www.example.com');
define('WP_HOME', 'https://www.example.com');
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if( isset($_SERVER['HTTP_CF_VISITOR']) && strpos($_SERVER['HTTP_CF_VISITOR'], 'https') )
$_SERVER['HTTPS']='on';
Read the rest

WordPress wp-config.php settings

Allow uploading not registered files

define('ALLOW_UNFILTERED_UPLOADS', true);

Disable All Updates

define( 'AUTOMATIC_UPDATER_DISABLED', true );

To enable automatic updates

define( 'WP_AUTO_UPDATE_CORE', true );

WP_SITEURL

define( 'WP_SITEURL', 'http://example.com/wordpress' );

WP_HOME

define( 'WP_HOME', 'http://example.com/wordpress' );

Disable the cron entirely by setting DISABLE_WP_CRON to true.Read the rest

Move out WordPress installation from public_html/ folder

cd your public_html/ and create OLD_WP/ folder

mkdir OLD_WP/

This will move WordPress' files/folders into the OLD_WP/ folder

mv wp-* index.php .htaccess robots.txt *.sql license.txt readme.html sitemap.xml xmlrpc.php error_log cgi-bin -t OLD_WP/

Then move it to level up

mv OLD_WP/ ../
Read the rest

WordPress default index.php file

Short command:

curl -s https://alltime.pp.ua/downloads/wpindex.txt > index.php

##

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
Read the rest