// Pre-populate edit form with data from existing post, regardless of status, with error handling add_filter(‘gform_pre_render’, ‘populate_edit_form_with_pending_post_data’); function populate_edit_form_with_pending_post_data($form) { // Get the current user ID and validate it $user_id = get_current_user_id(); if (!$user_id) { error_log(“Error: Unable to retrieve user…Continue reading
// Disable default WordPress image sizes add_filter(‘intermediate_image_sizes’, ‘__return_empty_array’); // Disable large scaled image size add_filter(‘big_image_size_threshold’, ‘__return_false’); // Disable WooCommerce image sizes and prevent WooCommerce from regenerating sizes add_action(‘after_setup_theme’, function () { // WooCommerce image sizes remove_image_size(‘woocommerce_thumbnail’); remove_image_size(‘woocommerce_single’); remove_image_size(‘woocommerce_gallery_thumbnail’); // Clear…Continue reading
add_filter( ‘wp_get_attachment_image_attributes’, function( $attr ) { if ( ! isset( $attr[‘loading’] ) || ‘lazy’ !== $attr[‘loading’] || ! isset( $attr[‘sizes’] ) ) { return $attr; } // Skip if attribute was already added. if ( false !== strpos( $attr[‘sizes’], ‘auto,’…Continue reading
function display_post_url() { return get_permalink(); } add_shortcode(‘post_url’, ‘display_post_url’);Continue reading
function mepr_custom_checkout_image() { ?> (function($) { $(document).ready(function() { // Select the product image on the checkout page and change its source to a new image URL $(“.mp-table > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > img:nth-child(1)”).attr(“src”,”https://airfryerkogebogen.dk/wp-content/uploads/2024/11/airfryerkogebogen.png”); }); })(jQuery); <?php } add_action(…Continue reading
add_filter(‘aioseo_schema_output’, ‘aioseo_remove_health_and_beauty_business_schema’); function aioseo_remove_health_and_beauty_business_schema($graphs) { foreach ($graphs as $index => $value) { if (isset($value[‘@type’]) && $value[‘@type’] === ‘HealthAndBeautyBusiness’) { unset($graphs[$index]); } } return $graphs; }Continue reading
function custom_divi_layout_replacer_menu() { add_menu_page( ‘Divi Layout Replacer’, ‘Divi Layout Replacer’, ‘manage_options’, ‘divi-layout-replacer’, ‘custom_divi_layout_replacer_page’, ‘dashicons-editor-table’, 20 ); } add_action(‘admin_menu’, ‘custom_divi_layout_replacer_menu’); function custom_divi_layout_replacer_page() { global $wpdb; ?> Divi Layout Replacer This tool allows you to search for posts with a specific layout…Continue reading
// Custom query for Elementor archive loop widget with ID ‘related_vendor_loop’ add_action( ‘elementor/query/related_vendor_loop’, ‘related_vendor_loop_query’ ); function related_vendor_loop_query( $query ) { // Log that the function has been triggered error_log( ‘related_vendor_loop_query function called’ ); // Ensure we have a valid WP_Query…Continue reading