Make Product Non Purchasable for Wholesale Customer if Product Stock is Less Than Certain Amount

/* Make Product Non Purchasable for Wholesale Customer Iif Product Stock is Less Than X Amount */ add_filter( ‘woocommerce_is_purchasable’, ‘wwpp_limit_purchase_based_on_stock’, 10, 2 ); function wwpp_limit_purchase_based_on_stock( $is_purchasable, $product ) { //Get Product Stock Quantity $product_quantity = $product->get_stock_quantity(); //Get current user’s wholesale…Continue reading

Force nwwp Colour Scheme

add_action( ‘admin_init’, function() { // remove the color scheme picker remove_action( ‘admin_color_scheme_picker’, ‘admin_color_scheme_picker’ ); // force all users to use the “Ectoplasm” color scheme add_filter( ‘get_user_option_admin_color’, function() { return ‘nwwp’; }); });Continue reading

Remove SEO Statistics from the Dashboard menu

add_action( ‘admin_menu’, ‘aioseo_hide_search_stats_menu’, 99999 ); function aioseo_hide_search_stats_menu() { global $submenu; if ( ! isset( $submenu[‘index.php’] ) ) { return; } foreach ( $submenu[‘index.php’] as $index => $props ) { if ( ! empty( $props[2] ) && admin_url( ‘/admin.php?page=aioseo-search-statistics’ ) ===…Continue reading

Remove name property from Schema

add_filter( ‘aioseo_schema_output’, ‘aioseo_filter_schema_output’ ); function aioseo_filter_schema_output( $graphs ) { if ( false === strpos( $_SERVER[‘REQUEST_URI’], ‘home-search/listing/’ ) ) { return $graphs; } foreach ( $graphs as $index => $graph ) { if ( isset( $graphs[ $index ][‘name’] ) ) {…Continue reading

Duplicate Posts and Pages

// Add the duplicate link to action list for post_row_actions // for “post” and custom post types add_filter( ‘post_row_actions’, ‘rd_duplicate_post_link’, 10, 2 ); // for “page” post type add_filter( ‘page_row_actions’, ‘rd_duplicate_post_link’, 10, 2 ); function rd_duplicate_post_link( $actions, $post ) {…Continue reading

Add Image Alt Text automatic (copy)

function add_alt_text_to_images( $html ) { // Check if the image has a title attribute if ( preg_match( ‘/(title=[“‘].*?[“‘])/’, $html, $matches ) ) { // Get the title $title = substr( $matches[0], 7, -1 ); // Check if the image has…Continue reading