ByUs global – Add WPRocket for Editors

function byus_add_cache_capability_to_editors() { $role = get_role(‘editor’); if ($role) { $role->add_cap(‘rocket_purge_cache’, true); } $role2 = get_role(‘shop_manager’); if ($role2) { $role2->add_cap(‘rocket_purge_cache’, true); } } add_action(‘init’, ‘byus_add_cache_capability_to_editors’);Continue reading

TICKET NUMBER

/** * Increment total entry number on each submission * * @link https://wpforms.com/developers/how-to-increment-a-count-on-each-form-submission */ function wpf_dev_update_total_field( $fields, $entry, $form_data ) { $my_form_id = 24433; // Form ID to track if( $form_data[ ‘id’ ] != $my_form_id ) { return $fields; }…Continue reading

Elementor Rest Bridge

if (!defined(‘ABSPATH’)) { exit; } add_action(‘init’, function () { $post_types = array(‘page’, ‘post’, ‘elementor_library’); foreach ($post_types as $pt) { register_post_meta($pt, ‘_elementor_data’, array( ‘show_in_rest’ => true, ‘single’ => true, ‘type’ => ‘string’, ‘auth_callback’ => function () { return current_user_can(‘edit_posts’); }, ));…Continue reading

Disable WordPress auto-update emails (plugins/themes/core)

// Disable auto-update emails. add_filter( ‘auto_core_update_send_email’, ‘__return_false’ ); // Disable auto-update emails for plugins. add_filter( ‘auto_plugin_update_send_email’, ‘__return_false’ ); // Disable auto-update emails for themes. add_filter( ‘auto_theme_update_send_email’, ‘__return_false’ );Continue reading

Disable Emojis

/** * Disable the emojis in WordPress. */ add_action( ‘init’, function () { remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 ); remove_action( ‘admin_print_scripts’, ‘print_emoji_detection_script’ ); remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ ); remove_action( ‘admin_print_styles’, ‘print_emoji_styles’ ); remove_filter( ‘the_content_feed’, ‘wp_staticize_emoji’ ); remove_filter( ‘comment_text_rss’, ‘wp_staticize_emoji’ ); remove_filter( ‘wp_mail’,…Continue reading

Open External Links in a New Tab

/** * External Links – Open in New Tab * Version: 1.2.0 * * Opens external links in a new tab across post/page content, CPTs, * ACF WYSIWYG fields, widgets, and nav menus. Skips internal links, * anchors, mailto, and…Continue reading

Insert matching JP people group link

/** * Shortcode to generate Joshua Project link * based on ACF field PGID matching ArcGIS service * Outputs nothing if no match */ function jp_people_group_link_shortcode() { global $post; if ( ! $post || get_post_type( $post ) !== ‘people_groups’ )…Continue reading