Custom fields in the billing address section woocommerce

I have run into these issues before myself. I am not entirely sure it’s possible to get adjust the billing address box directly unless you adjust the actual email template for the emails. Specifically, if you have access to the file structure, look in the “/wp-content/plugins/woocommerce/templates/emails” folder of the WooCommerce Plugin. They are made to … Read more

Is there a way to assign a default Category to a Post when the user creates a new Post?

WordPress presents default category as a setting in Settings -> Writing (though this doesn’t seem to pre-check the checkbox): The new_to_auto-draft action will allow you to do things to a new post before the page loads, and does pre-check the checkbox (tested): add_action( ‘new_to_auto-draft’, static function ( $post ) { $default_category_id = 25; // The … Read more

Function attached to cron job not running but will run if called manually

It looks like the time() was not set correctly in the first iteration of the function wp_schedule_event; First, remove this task from the queue by adding a function wp_clear_scheduled_hook and reload the page. For your example: wp_clear_scheduled_hook( ‘opportunities_cron_job’ ); Remove the cleaning function. Restart your code. If your date is not set correctly again, use … Read more

Custom post type template not loading from plugin

I think your first method isn’t working because it’s a theme method, not a plugin method. I could be entirely incorrect but I think the method of using single-custom_post_type.php only works for themes. (Again, I 100% could be wrong.) However, this is what I use and it always works: function wpse_post_type_templates( $template ) { if( … Read more

Prefix user login_name and validate it is unique on Registration

The usual way to create a user goes with the register_new_user function. This function offers no filter for the user name. It just checks for uniqueness with username_exists. To actually create the user register_new_user then calls wp_create_user, which in turn calls wp_insert_user. The latter function contains the pre_user_login filter. Then it calls username_exists again, because … Read more

Is there a way to pull remotely generated XML, process it, and display it on a Managed WordPress page?

Step-by-Step Guide to Create a WordPress Plugin for Fetching and Displaying Remote XML Data 1. Create a New Plugin Directory Connect to your WordPress installation via FTP or use the file manager in your hosting control panel. Navigate to wp-content/plugins/. Create a new directory named remote-xml-fetch. 2. Create the Plugin File Inside the remote-xml-fetch directory, … Read more

‘At a Glance’ dashboard: combining infos

dashboard_glance_items is a filter hook, not an action hook. See here for an explanation of the difference. Your at_glance() function doesn’t include the existing values, so only the items you return will be present in the At A Glance widget items. Something more like this: function at_glance( $items ) { $number_users = count_users(); $text = … Read more

How to check if we are in the init hook?

You can use did_action to test for this, e.g.: if ( did_action( ‘init’ ) < 1 ) { // init has not ran yet! Throw the exception } https://developer.wordpress.org/reference/functions/did_action/ did_action returns the number of times that action has been run. This can also be used to ensure it only happens once for filters that happen … Read more