Exclude Common Inline Scripts from SiteGround Speed Optimizer JavaScript File Combination

add_filter( ‘sgo_javascript_combine_excluded_inline_content’, ‘js_combine_exclude_inline_script’ ); function js_combine_exclude_inline_script( $exclude_list ) { $exclude_list[] = ‘window.OneSignalDeferred = window.OneSignalDeferred’; $exclude_list[] = ‘fbq(‘; $exclude_list[] = ‘document.currentScript?.remove’; // Part of Formidable Honeypot $exclude_list[] = “const style = document.createElement( ‘style’ )”; // Part of Formidable Honeypot return $exclude_list;…Continue reading

Disable comments

add_action(‘admin_init’, function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === ‘edit-comments.php’) { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’); // Disable support for comments and trackbacks in…Continue reading

WPForms Quiz — Save results as Entry Note

/** * WPForms Quiz — Save results as Entry Note * * Automatically adds a note to each quiz entry with the quiz results. * Supports all three quiz types: Graded, Personality, and Weighted. * * @link https://wpforms.com/developers/wpforms_process_entry_save/ */ /**…Continue reading

Mytestsnippet

global $wpdb; $table_name = $wpdb->prefix . ‘myfirst’; // Use prefix for security $results = $wpdb->get_results(“SELECT * FROM $table_name”); if ( ! empty( $results ) ) { echo ‘ ‘; foreach ( $results as $row ) { echo ‘ ‘; echo…Continue reading

Admin Area—Prevent Mouse Scroll Changing Number Inputs

function preventNumberScroll(e) { if (e.target.matches(‘input[type=”number”]’) || e.target.closest(‘input[type=”number”]’)) { e.preventDefault(); } } document.addEventListener(‘wheel’, preventNumberScroll, { passive: false, capture: true }); document.addEventListener(‘mousewheel’, preventNumberScroll, { passive: false, capture: true }); document.addEventListener(‘DOMMouseScroll’, preventNumberScroll, { passive: false, capture: true });Continue reading

Single Line Form adjustments

/* Input fields styling */ #wpforms-758 .wpforms-field input[type=”text”], #wpforms-758 .wpforms-field input[type=”email”] { background-color: #1c355e !important; border: 1px solid #ffffff !important; border-radius: 3px !important; color: #ffffff !important; } /* Placeholder text color */ #wpforms-758 .wpforms-field input[type=”text”]::placeholder, #wpforms-758 .wpforms-field input[type=”email”]::placeholder { color:…Continue reading