Skip to content

Instantly share code, notes, and snippets.

View patrickfreitasdev's full-sized avatar

Patrick de Freitas patrickfreitasdev

View GitHub Profile
@patrickfreitasdev
patrickfreitasdev / defender-cron-cli-debug.php
Created July 19, 2026 01:10
[Defender Pro] Cron and CLI debug
<?php
/**
* Plugin Name: [Defender Pro] WP-CLI / deactivation debug (Rev.1)
* Description: Captures WP-CLI runtime details and full backtraces when Defender is deactivated. Drop into wp-content/mu-plugins/. Adapted from https://gist.github.com/wpmudev-sls/3600f4c2f5e1c93d4b4afa81b0423f4c
* Author: WPMU DEV Support
* License: GPLv2 or later
*
* IMPORTANT: Must live in mu-plugins/ so it loads before Defender. If deactivate_plugins()
* runs during wp-defender.php include, a normal plugins_loaded hook is too late.
*/
<?php
// Update new posts to have the correct publication URL
add_filter('wp_insert_post_data', 'update_post_file_to_append_proxy', 10, 1);
function update_post_file_to_append_proxy(array $data): array
{
// We don't need to take actions for publications, any other post type we will proceeed.
if($data['post_type'] == 'publications'){
<?php
add_action('admin_init', 'fix_duplicated_post_meta');
function fix_duplicated_post_meta()
{
if (!isset($_GET['fix-divi-duplicated-post-meta'])) return;
$post_meta = '_et_pb_use_builder';
<?php
/**
* Plugin Name: Forminator
* Description: Decrease user balance on form submission.
* Author: Patrick Freitas @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
<?php
// Under development
if (!defined('ABSPATH')) {
exit;
}
class WDEV_Smush_GrapghQL_Support
{
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WDEV_Smush_Fix_Keep_Showing_Resmush {
private $smush_settings;
private $webp_helper;
private $webp_dir;
private $media_item_cache;
public $exclude_size_names = array( 'full' );
<?php
if (!function_exists('wp_smush_cdn')) {
function wp_smush_cdn()
{
static $smush_cdn;
if (is_null($smush_cdn) && class_exists('\WP_Smush')) {
$smush_cdn = \WP_Smush::get_instance()->core()->mod->cdn;
}
return $smush_cdn;
<?php
add_filter(
'forminator_custom_form_user_registration_before_insert',
function ($new_user_data) {
add_action('user_register', 'wpmudev_forminator_filter_user_register_email', 10, 2);
return $new_user_data;
}
);
<?php
add_action('wp_footer', function () {
global $post;
if (!$post instanceof WP_Post || !has_shortcode($post->post_content, 'forminator_form')) {
return;
}
?>
<script type="text/javascript">
<?php
/**
* Plugin Name: [Forminator] Upload mapping to ACF image field
* Description: Solves a bug that prevents upload field mapping to ACF image field through post data form
* Author: Prashant Singh @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if (!defined('ABSPATH')) {