Register Formidable Forms Views Public Post Type

add_action(‘admin_init’, function () { global $wp_post_types; if (isset($wp_post_types[‘frm_display’])) { $post_type = $wp_post_types[‘frm_display’]; $post_type->public = true; $post_type->show_ui = true; $post_type->show_in_nav_menus = true; } });Continue reading

ACF Field Shortcode

function acf_field_shortcode($atts) { $atts = shortcode_atts(array( ‘field’ => ”, ‘post_id’ => false, ), $atts, ‘acf’); if (function_exists(‘get_field’)) { $field_value = get_field($atts[‘field’], $atts[‘post_id’]); // If the field is an array (like a select, relationship, or taxonomy field) if (is_array($field_value)) { $output…Continue reading

Mobile Redirect

add_action(‘template_redirect’, ‘rd_mobile_redirect’); function rd_mobile_redirect() { // 1. Don’t redirect if we are in the editor or doing ajax if ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) return; if ( isset( $_GET[‘elementor-preview’] ) ) return; // 2. Detect Mobile Devices $is_mobile…Continue reading

[DEBUG] SiteGround Purge Scheduling

add_filter(‘pre_schedule_event’, function ($pre, $event /*, $wp_error */) { if (is_object($event) && isset($event->hook) && $event->hook === ‘siteground_optimizer_purge_cron_cache’) { $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 18); $lines = []; foreach ($bt as $f) { $fn = (isset($f[‘class’]) ? $f[‘class’] . ($f[‘type’] ?? ”) : ”)…Continue reading

Cloudflare Gravity Forms fix

add_filter( ‘wp_inline_script_attributes’, function ( $attributes, $javascript ) { if ( strpos( $javascript, ‘gform.’ ) ) { $attributes[‘data-cfasync’] = ‘false’; } return $attributes; }, 10, 2 );Continue reading