WooCommerce – Call to undefined function is_woocommerce()

If you want to check one Plugin’s Function / Class etc. from another Plugin, then it’s best to use a hook like plugins_loaded. Based on this, your Plugin CODE will look like: <?php /* Plugin Name: YOUR PLUGIN NAME */ defined( ‘ABSPATH’ ) or exit; add_action( ‘plugins_loaded’, ‘plugin_prefix_woocommerce_check’ ); function plugin_prefix_woocommerce_check() { if( function_exists( ‘is_woocommerce’ … Read more

What might cause a POST to wp-admin/async-upload.php to return JSON >and< HTML?

I had the same issue and did not find any information in my debug output. It worked out, that DOING_AJAX was not defined (I don’t know why). Changing the beginning of async-upload.php from if ( isset( $_REQUEST[‘action’] ) && ‘upload-attachment’ === $_REQUEST[‘action’] ) { define( ‘DOING_AJAX’, true ); } to define( ‘DOING_AJAX’, true ); worked … Read more

How to create custom 401, 403 and 500 error pages?

Error pages are served up via .HTACCESS, if you are using Apache you would use the ErrorDocument directive and add the status and URL to it. So it would look like this in your .htaccess file: ErrorDocument 401 http://yourwebsite.com/error-401 ErrorDocument 403 http://yourwebsite.com/error-403 ErrorDocument 500 http://yourwebsite.com/error-500 You could use the following function below. This will dynamically … Read more