Skip to content

Instantly share code, notes, and snippets.

View vmanthos's full-sized avatar

Vasilis Manthos vmanthos

  • Thessaloniki, Greece
  • 11:22 (UTC +03:00)
  • X @vmanthos
View GitHub Profile
<?php
require( 'wp-load.php' );
define('WP_USE_THEMES', false);
$sku = 'wp-pennant';
// get the product ID from the SKU
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku ) );
<?php
/**
* Plugin Name: WP Rocket | Disable permissions warnings about "cache" folders
* Description: It will prevent WP Rocket from displaying warnings on environments where the "cache" folders aren't writeable.
* Author: Vasilis Manthos
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
// Basic security, prevents file from being loaded directly.
<?php
/**
* Plugin Name: WP Rocket | Cache Dynamic Cookie
* Description: Adds a dedicated dynamic cache for a defined cookie ID.
* Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/cache/wp-rocket-cache-dynamic-cookie/
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
<?php
/**
* Plugin Name: WP Rocket | No Cache for IP
* Description: Disable WP Rocket caching and optimizations by IP.
* Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/cache/wp-rocket-no-cache-for-admins/
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
<?php
defined( 'ABSPATH' ) || die( 'Cheatin&#8217; uh?' );
$current_theme = wp_get_theme();
if ( 'uncode' === strtolower( $current_theme->get( 'Name' ) ) || 'uncode' === strtolower( $current_theme->get( 'Template' ) ) ) {
/**
* Excludes Uncode init and ai-uncode JS files from minification/combine
*
* @since 3.1
@vmanthos
vmanthos / gist:d63f639ccbcabafac5c46958f1aeb639
Created June 14, 2019 05:21
wp-rocket-static-no-opt-css-mobile.php
<?php
/**
* Plugin Name: WP Rocket | No Optimized CSS Delivery on Mobile
* Description: Disables optimized CSS delivery for mobile devices.
* Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/static/wp-rocket-static-no-opt-css-mobile/
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
@vmanthos
vmanthos / speed-up-404-static-files.php
Created May 24, 2019 11:55
Skip WordPress handling 404 on static files to avoid lack of performance.
<?php
/**
* Plugin Name: Speed Up 404 Static File
* Description: Skip WordPress handling 404 on static files to avoid lack of performance.
* Author: GeekPress
* Licence: GPLv2 or later
* */
$path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
$path = explode( '/', $path );
@vmanthos
vmanthos / docker-help.md
Created February 9, 2019 15:46 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@vmanthos
vmanthos / wp-config.php
Created February 9, 2019 14:10 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
// Explicitely setting url
define( 'WP_HOME', 'http://domain.com' );
define( 'WP_SITEURL', 'http://domain.com' );
// Set url to... whatever.
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
function activate_plugin_via_php() {
$active_plugins = get_option( 'active_plugins' );
array_push($active_plugins, 'cloudflare-flexible-ssl/plugin.php');
update_option( 'active_plugins', $active_plugins );
}
add_action( 'init', 'activate_plugin_via_php' );