Skip to content

Instantly share code, notes, and snippets.

View patrickfreitasdev's full-sized avatar

Patrick de Freitas patrickfreitasdev

  • WPMU DEV
  • Perth | Australia
View GitHub Profile
View fix-duplicated-entry-meta.php
<?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';
View balance-on-submission.php
<?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
*/
View graphql-smush-cdn.php
<?php
// Under development
if (!defined('ABSPATH')) {
exit;
}
class WDEV_Smush_GrapghQL_Support
{
View wdev-smush-fix-keep-showing-reconvert-webp.php
<?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' );
View smush-preload-image-with-cdn.php
<?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;
}
View forminator-user-email.php
<?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;
}
);
View from-to-calculator.php
<?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">
View wpmudev-upload-mapping-custom-field.php
<?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')) {
View forminator-validate-minimum-phone-field-characters.php
<?php
/**
* Plugin Name: [Forminator] - Add support for limit minimum Forminator phone fields characters
* Description: [Forminator] - Add support for limit minimum Forminator phone fields characters
* Based on https://gist.github.com/wpmudev-sls/b20040d0f49fb822553194fd0a34d5ff
* Author: Thobk @ WPMUDEV | Patrick Freitas @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) { exit; } elseif ( defined( 'WP_CLI' ) && WP_CLI ) { return; }
View sample-inline-css.html
<div>
<div style="display: block; background-color: #ddd; color: black; padding: 10px;">
Name:
</div>
<div style="display: block; color: black; padding: 10px 20px;">{name-1}</div>
<div style="display: block; background-color: #ddd; color: black; padding: 10px;">
Email:
</div>
<div style="display: block; color: black; padding: 10px 20px;">{email-1}</div>