MainWP Blog

Tips & Tricks
Bogdan Rapaic

Remove Custom Branding for a Specific User on Child Sites

MainWP Child 4.0.3, released on October 1st, 2019, introduced one handy filter mainwp_child_branding_init_options that can be used to hide custom branding for a specific user on child sites. Let’s see the usage example: add_filter( ‘mainwp_child_branding_init_options’, ‘mycustom_mainwp_child_branding_init_options’ ); function mycustom_mainwp_child_branding_init_options( $option ) {        $current_user_id = get_current_user_id();        if ( $current_user_id == ‘1’ && is_array( $option ) && isset( $option[ ‘cancelled_branding’ ] ) ) {        $option[ ‘cancelled_branding’ ] = true;    }        return $option; } In this example, all custom MainWP Branding Extension options will be applied for all users no the child site except for the user with ID 1. Also, the filter

Testing WooCommerce Updates
MainWP Extensions
Sebastian Moran

Using the MainWP Staging Extension for Testing WooCommerce Updates

With the breaking changes for WooCommerce if running versions earlier than 3.5.x due to WordPress 5.x release, now is the time to create a staging site. A staging site can be used to test the active theme updates, the WooCommerce-related plugins, and the WooCommerce plugin. Creating a staging site allows you to test plugin updates without having to cause issues on the live child site. In the case of child sites using WooCommerce for e-commerce, this can mean a live site going down and causing a loss in revenue. The old mantra rings true for WooCommerce: Update on staging Test

How to use Action Log for MainWP
Extension Tutorials
Sebastian Moran

Using the Activity Log for MainWP Extension

MainWP now has a very useful way to track changes made on both the MainWP Dashboard site, as well as tracking changes to connected child sites using Activity Log for MainWP extension. First, you will need to install the WP Security Audit Log plugin on all of the connected child sites, which is very easy to bulk install plugins on your MainWP Dashboard site. Next, you will need to install the Activity Log for MainWP extension on your MainWP Dashboard site. Once the Activity Log for MainWP extension has been installed, follow the setup wizard for which child sites where

Protecting Child Sites From XML-RPC Brute Force Attacks
MainWP How To's
Sebastian Moran

Protecting Child Sites From XML-RPC Brute Force Attacks

WordPress in its core has a function called XML-RPC, which a limited number of plugins still use like Jetpack. More plugins used to use it when the only method would have been to use the XML-RPC. Most plugins now use the WordPress REST API to connect to a site to pull data from it, by either read or write access. XML-RPC is still targeted for brute force attacks on WordPress sites. A number of CDNs like Cloudflare and Sucuri will protect XML-RPC by default. Cloudflare even offers an easy way to redirect XML-RPC to the home page of a site

Troubleshoot WP Cron Job Issues
MainWP How To's
Sebastian Moran

Using WP-CLI to Troubleshoot WP Cron Job Issues on a Child Site

Sometimes you will run into issues on your child sites which are being caused by active cron jobs. Cron jobs are recurring tasks that need to be run on a site. Most of the time, cron jobs are created by the active plugins (e.g., these cron events all running due to WooCommerce): woocommerce_cancel_unpaid_orders woocommerce_cleanup_sessions woocommerce_cleanup_personal_data woocommerce_cleanup_logs woocommerce_scheduled_sales woocommerce_geoip_updater delete_expired_transients delete_version_transients Cron Events There are ways to view all cron jobs on a child site by using a plugin like WP Crontrol. In this post, we are going to use the many options that WP-CLI has related to cron jobs. There

MainWP How To's
Sebastian Moran

Staying Positive in 2019

With 2019 upon us, now is the time to focus on the new year. One of the best ways to have a healthy mental attitude is to keep a positive outlook. Life will throw you a few curve balls, and how you deal with those really does improve how you can stay driven and happy in the year ahead while maintaining a positive mental attitude. Positive thinking is not a new concept; there are thousands of self-help books and seminars out there for the taking, but focusing your mind to think positive helps carry you through adversity and anything that

wp profile - WP CLI Command
MainWP How To's
Sebastian Moran

Why Use the wp profile WP-CLI Command?

What is the wp profile Command in WP-CLI? wp profile command is designed for finding where and what is slowing a site down. As with any performance benchmarking, multiple runs will need to be used. Start by running the common commands for wp profile multiple times. This will help you find what is causing WordPress to load slowly on a site. wp profile stage This command will output a number of options in the table. They are broken down as: bootstrap is where WordPress is setting itself up, loading plugins and the main theme, and firing the init hook. main_query

WP-CLI - wp doctor
MainWP How To's
Sebastian Moran

WP-CLI wp doctor Command Why it Might Really Help Your Sites

What is the wp doctor command in WP-CLI? wp doctor lets you easily run a series of configurable checks to diagnose what’s ailing with WordPress. Without wp doctor, your team has to rely on their memory to manually debug problems. With wp doctor, your team saves hours identifying the health of your WordPress installs by codifying diagnosis procedures as a series of checks to run with WP-CLI. It comes with dozens of checks out of the box. name description autoload-options-size Warns when autoloaded options size exceeds the threshold of 900 kb. constant-savequeries-falsy Confirms expected state of the SAVEQUERIES constant. constant-wp-debug-falsy

WP-CLI
MainWP How To's
Sebastian Moran

What is the WP-CLI and why should I use it?

What is the WP-CLI? The WP-CLI is a way of doing anything that you would be able to do in the back-end of a WordPress site in wp-admin, but using command lines. A number of hosts have WP-CLI installed on new servers. One great example is on Cloudways. Common WP-CLI commands If a client site has a white screen issues from an active plugin or theme and you have sFTP/SSH access on the site, then you can change the active plugins. You can also change the site to a new theme, or install a new default theme to test if

Easy Cron for MainWP
MainWP Customization
Sebastian Moran

Disable WP Cron and use an external cron service for your MainWP Dashboard

The first step to use an external cron service like EasyCron to run MainWP crons, is this constant needs to be set in the MainWP Dashboard wp-config.php file. MainWP has a post which will help with this setting. define( ‘DISABLE_WP_CRON’, true ); For more information about WP Cron, see here. EasyCron is a task scheduler which provides services of calling specified URLs at a specified time or by a time interval. It eliminates the dependence on traditional Cron service and related knowledge to set up scheduled tasks. EasyCron offers free plans. After you have signed up for a free plan,

Looking for something?