Skip to content

Instantly share code, notes, and snippets.

View selul's full-sized avatar

Marius Cristea selul

View GitHub Profile
@selul
selul / index.php
Last active February 26, 2023 16:50
Add exif to Optimole
<?php
/*
* Plugin Name: Optimole Tweak - Add exif data.
* Version: 0.0.1
*/
add_filter( 'optml_replace_image', 'opml_add_exif', 99 );
add_filter( 'optml_content_url', 'opml_add_exif', 99 );
function opml_add_exif( $url ) {
@selul
selul / optimole-tweak.php
Last active August 31, 2022 16:33
Redirect Yoast attachments redirects to Optimole urls.
<?php
/*
* Plugin Name: Optimole Tweak - Redirect Yoast attachments to Optimole urls.
* Version: 0.0.1
*/
add_filter( 'wpseo_attachment_redirect_url', function ( $url ) {
return apply_filters( 'optml_content_url', $url );
}, 999 );
add_filter( 'attachment_link', function ( $url, $id ) {
@selul
selul / index.php
Last active September 13, 2021 07:25
Plugin that removes Neve block patterns
<?php
/*
Plugin Name: Remove Neve block patterns
Description: Plugin that removes Neve block patterns
Author: Themeisle
Version: 0.0.1
*/
add_action( 'admin_init', function () {
foreach ( WP_Block_Patterns_Registry::get_instance()->get_all_registered() as $pattern ) {
@selul
selul / index.php
Last active July 21, 2021 06:52
Remove login on wordpress site
<?php
/*
Plugin Name: Remove login.
Description: Plugin that removes login WordPress, useful on testing environments. Should never be used on production.
Author: Marius Cristea
Version: 0.0.1
*/
add_action( 'after_setup_theme', function () {
if ( ! is_user_logged_in() ) {
@selul
selul / index.php
Last active June 2, 2021 10:01
Force replacement on ajax when logged in
<?php
/*
Plugin Name: Optimole - Force replacements on ajax when logged in.
Version: 0.0.1
Requires PHP: 7.0
Author URI: https://optimole.com
*/
add_filter('optml_force_replacement',function($return){
if( is_user_logged_in() ){
@selul
selul / index.php
Created April 14, 2021 09:55
Disable Optimole replacement on WP Rest API for Yoast Head
<?php
/*
Plugin Name: Optimole - Disable replacement on Yoast head on Rest API
Version: 0.0.1
Requires PHP: 7.0
Author URI: https://optimole.com
*/
namespace OptmlTweaks;
@selul
selul / core_query_bans.php
Created November 8, 2016 10:21
Block slow performance queries from wordpress core
add_filter( 'query', 'sel_filter_slow_query', 999 );
function sel_filter_slow_query( $query ) {
//set an array of functions which run the slow queries:
$banned_functions = array ( 'count_users','bbp_get_statistics', 'bpbbpst_support_statistics' );
foreach($banned_functions as $banned_function){
if ( in_array( $banned_function , wp_list_pluck( debug_backtrace(), 'function' ) ) ) {
return "SELECT 1 ";
}
}