Min-Max Product Price (with decimal support)

add_filter( ‘wcv_product_price’, ‘price_min_max’ ); function price_min_max( $args ) { $args[‘custom_attributes’] = array( ‘min’ => 3.2, ‘max’ => 200.21, ‘step’ => 0.01, ‘data-parsley-type’ => ‘number’, ‘data-parsley-range-message’ => __( ‘Price must be between 3.2 and 200.01’, ‘wcvendors-pro’ ), ‘pattern’ => ‘[0-9]+([\.,][0-9]+)?’, ‘type’…Continue reading

Allow ICO Files Upload

function custom_allow_ico_upload($mimes) { $allowed_mime_types = array( ‘ico’ => ‘image/x-icon’ ); // Merge the allowed MIME types with the existing list $mimes = array_merge($mimes, $allowed_mime_types); return $mimes; } add_filter(‘upload_mimes’, ‘custom_allow_ico_upload’); function custom_handle_ico_upload_errors($file, $uploaded_file) { if (!empty($file[‘type’]) && $file[‘type’] === ‘image/x-icon’ &&…Continue reading

Allow WebP Files Upload

// Add WebP MIME type support function add_webp_mime_type($mime_types) { $mime_types[‘webp’] = ‘image/webp’; return $mime_types; } add_filter(‘upload_mimes’, ‘add_webp_mime_type’); // Enable WebP in the Media Library function enable_webp_upload($data, $file) { $file[‘ext’] = ‘webp’; return $data; } add_filter(‘wp_handle_upload_prefilter’, ‘enable_webp_upload’, 10, 2); // Enable…Continue reading

Disable Scripts and Stylesheets (functions.php)

// Check if page is the home page, if yes, then dequeue identified scripts. Improve load time. function check_page_id() { // Get the current page ID global $post; $the_post_type = $post->post_type; $page_id = get_queried_object_id(); // Check if the page ID…Continue reading

Hide Specific Plugins (functions.php)

// Remove plugin from client view to prevent potential issues if settings are changed. function idxc_hide_plugin() { if (is_admin()) { $current_user = wp_get_current_user(); // If the current user’s username is not “idxcentral”, hide the plugin if (‘idxcentral’ !== $current_user->user_login) {…Continue reading

Auto Add Child Pages To Menus

add_action(‘save_post’, function($post_id, $post, $update) { // Check if it’s a page if ($post->post_type !== ‘page’) { return; } // Check if the page has a parent $parent_id = $post->post_parent; // If it doesn’t have a parent, exit if (!$parent_id) {…Continue reading

Disable Author Archive

/* Get Statuscode 404 for existing & non-existing author archives. */ add_action( ‘template_redirect’, function() { if ( isset( $_GET[‘author’] ) || is_author() ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } }, 1 ); /* Remove the Author Links…Continue reading

Rank Math

// Change OG title for Rank Math on Vendor Pages function wcv_rankmath_change_og_title( $title ) { WC_Vendors::log( $title ); if ( WCV_Vendors::is_vendor_page() ) { $vendor_shop = urldecode( get_query_var( ‘vendor_shop’ ) ); $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); $shop_title = get_user_meta( $vendor_id, ‘pv_shop_name’,…Continue reading

Yoast SEO

// Change OG title for Yoast on Vendor Pages function wcv_wpseo_change_og_title( $title ) { if ( WCV_Vendors::is_vendor_page() ) { $vendor_shop = urldecode( get_query_var( ‘vendor_shop’ ) ); $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); $shop_title = get_user_meta( $vendor_id, ‘pv_shop_name’, true ); $og_title =…Continue reading