Skip to content

Instantly share code, notes, and snippets.

View seredniy's full-sized avatar
🏠
Working from home

Anton Serednii seredniy

🏠
Working from home
View GitHub Profile
@kagg-design
kagg-design / functions.php
Last active January 12, 2022 12:00
Fix performance problem with woodmart autoload.
<?php
if( ! function_exists( 'woodmart_autoload' ) ) {
function woodmart_autoload($className) {
global $woodmart_files;
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strripos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
@azizultex
azizultex / Remove an Action from a Plugin Class Method WordPress
Last active November 29, 2023 11:43
Remove a hook, filters from a Plugin Class Method WordPress
/**
* Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :)
* source: https://github.com/herewithme/wp-filters-extras
* More: http://wordpress.stackexchange.com/questions/57079/how-to-remove-a-filter-that-is-an-anonymous-object
*/
function remove_filters_for_anonymous_class( $hook_name = '', $class_name ='', $method_name = '', $priority = 0 ) {
global $wp_filter;
// Take only filters on right hook name and priority
if ( !isset($wp_filter[$hook_name][$priority]) || !is_array($wp_filter[$hook_name][$priority]) )