wp_mail vs mail functions and header arrays

Both the mail() function in PHP and wp_mail() in WordPress do support passing an array or string of headers, but the difference is: With mail(), the array keys are the header names and its values are the respective header values, e.g. array( ‘Content-type’ => ‘text/html; charset=utf-8’ ). wp_mail() on the other hand, expects that the … Read more

Warning: Attempt to read property “term_id” on int – Woocommerce

You can I think you should use get_terms_args filter instead of get_terms and just add exclude arg, so now get_terms() function won’t retrieve those cats and you’ll get right count. Here’s code example: add_filter( ‘get_terms_args’, ‘mamaduka_edit_get_terms_args’, 10, 2 ); /** * Exclude product categories from Woocommerce * */ function mamaduka_edit_get_terms_args( $args, $taxonomies ) { //print_r($taxonomies); … Read more

404 page is not the same when using PHP code in functions

template_include is a filter hook, so you are supposed to always return the full absolute filesystem path to a template, and not doing the get_template_part() and exit calls. And as for setting the 404 status, I would instead use the pre_handle_404 filter, but the wp action can also be used: (note that these examples are … Read more