Remove image sizes in WordPress

/** * Function to Remove image size. * @param [string] $size */ function remove_image_size_by_size($size) { $dimension = explode('x', $size); global

Handful WP-CLI Tricks

Delete posts based on search # Spaces needs replace with + (plus sign) # Eg: hello+world wp post delete $(wp

Tweaking OneSignal WordPress Plugin

/** * Send push based on last active time (Intelligent Delivery). */ add_filter( 'onesignal_send_notification', function( $fields ) { $fields['delayed_option'] =

Tweaking WordPress

/** * Logged in for 1 year. */ add_filter( 'auth_cookie_expiration', function() { return YEAR_IN_SECONDS; });

Use statically.io CDN with WP Offload Media

add_filter('as3cf_get_attachment_url', function($url) { // Regex matches both http and https. $url = 'https://cdn.statically.io/img/' . preg_replace('#^https?://#', '', $url); return $url; });

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

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

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,

WP Rocket Hooks

after_rocket_clean_post action is fired after clear cache of a post. add_action( 'after_rocket_clean_post', function( $post ) { if ( $post->post_name ==

Useful Yoast Hacks

I use Yoast SEO on all of my WordPress setup. Here are some hacks that I use for it. Disable