Skip to content

Instantly share code, notes, and snippets.

KAGG Design kagg-design

Block or report user

Report or block kagg-design

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kagg-design
kagg-design / gist:7cbda38a3ce76c0502748f8ddbc9bebe
Created Sep 5, 2019
Remove current action or filter from plugin
View gist:7cbda38a3ce76c0502748f8ddbc9bebe
<?php
/**
* Remove current action or filter from plugin
*
* @param string $class_name Class name enqueueing the action.
* @param null $action_name Action name.
*/
function remove_plugin_action( $class_name, $action_name = null ) {
global $wp_filter;
@kagg-design
kagg-design / add_admin
Created Apr 26, 2019
Simple mu-plugin to add admin to the site
View add_admin
<?php
/**
* Plugin Name: Add Admin
* Plugin URI: https://kagg.eu/en/
* Description: Add admin to the WordPress site.
* Version: 1.0
* Author: KAGG Design
* Author URI: https://kagg.eu/en/
* License: GPL2
*
View add_xdebug_cookie_to_cron_request.php
@kagg-design
kagg-design / kagg_syntaxhighlighter_precode.php
Last active Sep 6, 2019
Due to issue in SyntaxHighlighter Evolved plugin & symbol is output as &amp; what makes code unreadable.
View kagg_syntaxhighlighter_precode.php
<?php
/**
* Filter to fix issue in SyntaxHighlighter Evolved plugin.
*
* @param string $code Code to format.
* @param array $atts Attributes.
* @param string $tag Tag.
*
* @return string
*/
@kagg-design
kagg-design / clear-grp-cron-jobs.php
Created Jan 17, 2019
Clear multiple cron jobs created by Google Reviews Business plugin.
View clear-grp-cron-jobs.php
<?php
/**
* Clear multiple cron jobs created by Google Reviews Business plugin.
*/
function clear_cron_jobs() {
$crons = _get_cron_array();
$hook = 'grp_auto_save';
$args_array = array();
$new_cron = array();
foreach ( $crons as $timestamp => $cron ) {
@kagg-design
kagg-design / kagg_get_between.php
Last active Dec 9, 2018
Finds a substring between two strings.
View kagg_get_between.php
<?php
/**
* Finds a substring between two strings.
*
* @param string $string The string to be searched
* @param string $start The start of the desired substring
* @param string $end The end of the desired substring
* @param bool $greedy Use last instance of`$end` (default: false)
*
@kagg-design
kagg-design / class-downloader.php
Last active Sep 13, 2019
A class to hide downloadable links and count downloads.
View class-downloader.php
<?php
/**
* Class to hide file download links and count download number.
*
* @package kagg-downloader
*/
/**
* Class Downloader.
*
@kagg-design
kagg-design / disable-update-plugins.php
Last active Nov 20, 2018
Disable update of certain plugins.Put this file into /wp-content/mu-plugins/
View disable-update-plugins.php
<?php
/**
* Plugin Name: Disable updates plugins
* Plugin URI: https://kagg.eu/en/
* Description: Disable update of certain plugins.
* Version: 1.0
* Author: KAGG Design
* Author URI: https://kagg.eu/en/
* License: GPL2
*/
View admin-bar-menu-filter.php
<?php
/**
* Change site url in admin bar
*
* @param WP_Admin_Bar $wp_admin_bar
*/
function admin_bar_menu_filter( WP_Admin_Bar $wp_admin_bar ) {
$new_url = 'site.org';
$site_name_node = $wp_admin_bar->get_nodes()['site-name'];
$site_name_node->href = $new_url;
@kagg-design
kagg-design / full_list_of_wp_globals.php
Last active Nov 14, 2018
Full list of WordPress global variables, extracted from WP Coding Standards
View full_list_of_wp_globals.php
<?php
/**
* List of global WP variables.
*
* @since 0.3.0
* @since 0.11.0 Changed visibility from public to protected.
* @since 0.12.0 Renamed from `$globals` to `$wp_globals` to be more descriptive.
* @since 0.12.0 Moved from WordPress_Sniffs_Variables_GlobalVariablesSniff to WordPress_Sniff
*
* @var array
You can’t perform that action at this time.