Clear cache in WP Rocket when post permalink (slug) changes

To learn more about the issue: https://github.com/wp-media/wp-rocket/issues/1936 Fix: // Fires before an existing post is updated in the database. add_action( ‘pre_post_update’, function( $post_ID, $data ) { // compare slug, if changed clear cache. if ( get_post_field( ‘post_name’, $post_ID ) !=

Use statically.io CDN with WP Offload Media

add_filter( ‘as3cf_get_attachment_url’, function( $url ) { // matches http and https both. $url = ‘https://cdn.statically.io/img/’. preg_replace( ‘#^https?://#’, ”, $url ) .”; return $url; }); More hooks: https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront-tweaks/blob/master/amazon-s3-and-cloudfront-tweaks.php

Add additional IP addresses to Ubuntu

Login as root then enter command nano /etc/network/interfaces If have something like this on that file iface enp1s0f0 inet static address 123.124.125.40 netmask 255.255.255.0 gateway 123.444.123.1 Then to add additional ips, have it like this iface enp1s0f0 inet static address

Tweaking Mail-in-a-Box

Disable greylisting Disabling greylisting helps to receive emails without any delay. touch /etc/postgrey/whitelist_clients.local nano /etc/postgrey/whitelist_clients.local Then add # Don’t greylist any domain. /.*/ Save and Exit, then enter commands: service postgrey restart service postfix restart Source: https://discourse.mailinabox.email/t/disable-greylisting-modify-whitelist/137/2

Tweaking WSL (Windows Subsystem for Linux)

Use ‘exp’ command to open Windows Explorer Login as root in WSL then: touch /etc/profile.d/explorer.sh nano /etc/profile.d/explorer.sh Add the below lines to explorer.sh alias exp=”explorer.exe .” Now, reload settings using . ~/.profile . /etc/profile Done. Now whenever you type exp

Get system ipv4 addresses as array in PHP

/** * Get system ipv4 addresses. * Works on Linux only. * @return [array] */ function getSystemIPs() { $ips = shell_exec( ‘hostname -I’ ); $ips = preg_split( ‘/\s+/’, $ips, -1, PREG_SPLIT_NO_EMPTY ); foreach ( $ips as $ip ) { if

Use Rocket-Nginx under RunCloud

Login as root then enter following commands. cd /etc/nginx-rc git clone https://github.com/satellitewp/rocket-nginx.git cd rocket-nginx cp rocket-nginx.ini.disabled rocket-nginx.ini php rocket-parser.php As of version 2.1.1 there is a typo in the rocket-nginx.ini , change media_header to medias_header My template: https://gist.github.com/Dibbyo456/2b08a4ff74665ccc40e0985b8f22292a Create file {app-name}.location.main-before.rocket.conf

Upgrade cURL to latest version on Ubuntu

Tested on Ubuntu 16.04 only. Login as root then do the following: mkdir latestcurl cd latestcurl apt build-dep curl If E: Unable to find a source package for curl error appears then do the following otherwise skip the below part. sed

Tweaking WP Rocket

Edit function get_subscribed_events() on /wp-rocket/inc/classes/subscriber/admin/Settings/class-page-subscriber.php //[ ‘add_imagify_page’, 9 ], Edit function render_page() on  /wp-rocket/inc/classes/admin/settings/class-page.php /*$this->heartbeat_section(); $this->addons_section(); $this->cloudflare_section(); $this->sucuri_section();*/ Add to functions.php or wp-rocket.php /** * Clean Up WP Rocket. */ add_action( ‘init’, function() { // Hide account info. defined( ‘WP_ROCKET_WHITE_LABEL_ACCOUNT’

Create Self-Signed SSL Certificate in Windows

Download Full version EXE (64 bit) from OpenSSL Installer for Windows. Install files at C:\Program Files\OpenSSL Change OPENSSL_CONF variable in ENV Path. Goto C:\Program Files\OpenSSL\bin Create file domains.ext enter this codes. change/add your domains. authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation,

Optimal Settings & Tweaking UpdraftPlus

Optimal Settings: Untick ❌ -> UpdraftPlus Automatic Backups Untick ❌ -> Automatic updates Tick ✅ -> Backup more databases Tick ✅ -> Delete local backup Tweaking: Add below codes to: updraftplus.php /* Disable top admin bar */ defined( ‘UPDRAFTPLUS_ADMINBAR_DISABLE’ )

Disable cURL SSL verification in WordPress

/** * Don’t verify SSL certificates */ add_action( ‘http_api_curl’, function( $handle ) { curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, false ); });