Plugin README.txt isn’t updating in the Directory (stable tag is correct)

The short version is that you did it in the wrong order. First, you updated trunk with the new Stable Tag here: https://plugins.trac.wordpress.org/changeset/993543/post-deployment-hook Then, you actually tagged it here: https://plugins.trac.wordpress.org/changeset/993545/post-deployment-hook So between those commits, it updated and noticed you lacked the new directory. When it updated again later, it noticed the version had not changed … Read more

Function/Class to list categories with checkboxes

You can make wp_category_checklist() available in any of your templates using: require_once( ABSPATH . ‘/wp-admin/includes/template.php’ ); wp_category_checklist(); If you would like to have a shortcode for it, that parses the available arguments, here’s an example: add_shortcode(‘frontend-category-checklist’, ‘frontend_category_checklist’); function frontend_category_checklist($atts) { // process passed arguments or assign WP defaults $atts = shortcode_atts( array( ‘post_id’ => 0, … Read more

UWooCommerce – add cart discount programmatically?

I haven’t applied any discounts like that before, but have done it with ‘fees’ a lot. Adding a fee is quite easy: function custom_wc_add_fee() { WC()->cart->add_fee( ‘Fee’, -10 ); } add_action( ‘woocommerce_cart_calculate_fees’,’custom_wc_add_fee’ ); (or if you want a plugin solution, I created this plugin: https://aceplugins.com/plugin/woocommerce-advanced-fees/)

is pre_get_comments not working?

I don’t see any reason why pre_get_comments would not be working, it’s still in core, however… you’ve got a few problems in your code – do_action_ref_array is what core calls to trigger the action, you add your own functions to the action queue via add_action. orderby is the field name you want to order by, … Read more

Update Data parameter of a wp_localize_script() call

wp_localize_script results in your data being printed to the page before your script tag via PHP, whether it be in wp_head or wp_footer, depending on where you’ve set your script to be output. Calling wp_localize_script from an AJAX handler won’t do anything, you’re returning data via JavaScript. What you can do is put any data … Read more

How do I link to a php file in my plugin directory?

You can use admin.php?action=my_action and WordPress will fire the equivalent action hook: // How to get the URL $url = admin_url( “admin.php?action=wpse_21460_export&any_other_arguments” ); // How to handle the URL function wpse_21460_export() { // Do your export and exit } add_action( ‘admin_action_wpse_21460_export’, ‘wpse_21460_export’ ); See how WordPress formats the hook name to admin_action_{value_of_action_param}