Skip to content

Instantly share code, notes, and snippets.

View mi5t4n's full-sized avatar

Sagar Tamang mi5t4n

View GitHub Profile
@mi5t4n
mi5t4n / README.md
Created May 14, 2024 04:08 — forked from joemaller/README.md
Fix term counts so wp-admin Taxonomy listings show the correct number of items for the selected post_type.

Fixing post counts for WordPress taxonomies

The problem

For WordPress sites using Custom Post Types, Taxonomy admin listings show cumulative term-assignment totals for all post_types instead of counts specific to the selected post_type. Since Taxonomy listings are always attached to a single post_type, totals for shared taxonomies don't make sense.

The Goal

Fix term counts so wp-admin Taxonomy listings show the correct number of items for the selected post_type.

@mi5t4n
mi5t4n / xdebug.md
Last active February 7, 2024 10:30
xdebug

; ########### Common ################## xdebug.start_with_request=trigger xdebug.profiler_enable=0 memory_limit = 1024M xdebug.max_nesting_level = 1024

; ########### Xdebug v2 ################## ;xdebug.remote_enable=1 ;xdebug.remote_port=9003

@mi5t4n
mi5t4n / dokan-order-split-from-backend.php
Last active April 26, 2022 16:05
Split orders when order containing products from multiple vendor is created from admin dashboard in Dokan plugin.
<?php
/**
* Split orders when order containing products from multiple vendor is created from admin dashboard.
*/
function sagar_order_creation_fix( $post_id, $post, $update ) {
// Bail early if not admin.
if( ! is_admin() ) {
return;
}
@mi5t4n
mi5t4n / dokan-add-to-cart.php
Last active April 26, 2022 15:57
Make product purchasable based on the vendor opening and closing time in dokan plugin.
<?php
/**
* Hide or display add to cart button based on opening hours.
*/
function prefix_woocommerce_is_purchasable( $is_purchasable, $product ) {
// Get the store id.
$store_id = get_post_field( 'post_author', $product->get_id() );
// Get the store info.