Skip to content

Instantly share code, notes, and snippets.

View xavier-bs's full-sized avatar

xavier birnie-scott xavier-bs

View GitHub Profile
@xavier-bs
xavier-bs / remove_filter.php
Last active May 3, 2021 13:31
Fonctionnalities for WP >= 4.7 to remove filter/action defined by a callback function, a static or dynamic method from a class,
<?php
/**
* Function remove_filter_x(): Remove filter/action defined by a callback function, a static or dynamic method from a class
* WP version >= 4.7
* @author Xavier Birnie-Scott <xavierbirniescott@yahoo.fr>
* @version 1.0 [2020-12-18] Short version
* @see https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/
* @see https://murviel-info-beziers.com/supprimer-filtre-action-methode-classe-wordpress/
* @param array $args: [
* 'hook' hook name, mandatory
@xavier-bs
xavier-bs / post-wplink.js
Last active December 7, 2020 22:01
Fonctionality to alter wplink plugin. Adds new checkboxes to define rel attribute in <a> tag with noopener, noreferer, sponsored, nofollow and/or external values
/**
* Fonctionality to alter wplink plugin,
* Adds new checkboxes to define rel attribute in <a> tag with noopener, noreferer, sponsored, nofollow and/or external values.
* Enqueue with admin_enqueue_scripts on post.php and post-new.php
* wp_enqueue_script( 'post-wplink', "/url/to/post-wplink.js", ['wplink'], $version, true );
* wlink-open event occurs when Insert/edit link modal box opens
* wpLink.buildHtml function replaces the function from wplink.js
* The string translate.mark_as_string might be define with localize_script(), contains __( 'Mark as <code>%s</code>', $textdomain );
* Values that may be added to the rel attribute are defined in the rels array.
* We push down the search terms div of shift=140 px and expand the modal height to 600 px. You may set these values to whatever you want.