$wpdb->prepare() looks like sprintf() and behaves differently in the one way that matters: %s adds the surrounding quotes itself. Writing them by hand produces a doubly-quoted value and…
CSV is not a format you should parse with explode() — quoted fields containing the delimiter, and escaped quotes inside those, break it immediately. fgetcsv() handles all of…
Business logic in a controller is reachable from exactly one place: an HTTP request. The first time the same operation is needed from a console command, a queue…
Applying a transformation to every scalar in a nested array — trimming decoded JSON, casting numeric strings — usually produces a small recursive function that gets copied between…
Changing a price by filtering woocommerce_get_price alters it everywhere at once, including the catalogue and the order confirmation email — and it fires often enough to be a…
Everything that touches post output hangs off the same filter — autoembeds, wpautop, shortcode expansion, and every plugin. Priority decides the order, and getting it wrong is why…
A function returning a generator cannot be passed to anything expecting an array — count(), array_map(), json_encode() all fail or produce nonsense. iterator_to_array() is the escape hatch, and…
Reordering the checkout form by copying form-billing.php into the theme works and then quietly rots: every WooCommerce release that touches that template leaves your copy behind, and the…