ENV for WordPress

As I don’t know why rails prefer to store such secrets in an environment variable the answer might not be complete, but if the reason is to avoid having it in the code and therefor accessible to everybody with access to the code (via git or misconfigured web server), wordpress has two ways to do … Read more

WooCommerce, change “Add to Cart” to “Link to Product”, only for specific categories

You can just add another check within that filter – get the category of the product the filter is currently active on and compare it with the category you want to target. add_filter( ‘woocommerce_loop_add_to_cart_link’, ‘replace_loop_add_to_cart_button’, 10, 2 ); function replace_loop_add_to_cart_button( $button, $product ) { if( $product->is_type( ‘variable’ ) ) return $button; // array of slugs … Read more

WPDB query suddenly not working

You should only interact with the DB via WP, not directly. It’s not a big deal in your case because you just want to see a value, but you’ll be more aligned with the best practices if you go in trying to solve a problem with $wpdb as a last resort. In your case, you … Read more