Force Product Slug to Numerical Product ID

// See [Using only ID in product url in WooCommerce?](https://stackoverflow.com/a/70457452) add_action(‘save_post_product’, ‘incontrol_set_product_title’, 10, 3); function incontrol_set_product_title ($post_id){ // This temporarily removes action to prevent infinite loops remove_action(‘save_post_product’, ‘incontrol_set_product_title’); // Update title wp_update_post(array( ‘ID’ => $post_id, ‘post_name’ => $post_id // WordPress…Continue reading

Force Product Slug to Numerical Product ID

// See [Using only ID in product url in WooCommerce?](https://stackoverflow.com/a/70457452) add_action(‘save_post_product’, ‘incontrol_set_product_title’, 10, 3); function incontrol_set_product_title ($post_id){ // This temporarily removes action to prevent infinite loops remove_action(‘save_post_product’, ‘incontrol_set_product_title’); // Update title wp_update_post(array( ‘ID’ => $post_id, ‘post_name’ => $post_id // WordPress…Continue reading

Admin/Floating Toolbar

/** * Create a secondary admin toolbar in the top right with integrated plugin/users search * * @author mccannex * * Changelog * 2024-08-01 – Fixed issue with crashing admin backend because WP core changed priority on certain hooks *…Continue reading

Event Helpers

do_action( ‘qm/debug’, ‘[EventHelpers] Registering’ ); function current_events_filter($data) { // Get current time in GMT $now = new \DateTime(‘now’); $now->setTime(0, 0); $filtered = array_filter($data, function($element) use ($now) { if(isset($element->post_date)) { $post_date = new \DateTime($element->post_date); $post_date->setTime(0, 0); if($post_date >= $now) { return…Continue reading

Studio Helpers

do_action( ‘qm/debug’, ‘[StudioHelpers] Registering’ ); function corrugated_studios_query($query) { $query->set(‘meta_query’, array( array( ‘key’ => ‘visible’, ‘value’ => 1, ‘compare’ => ‘=’ ) )); $query->set(‘post_type’, ‘corrugated-studio’); $query->set(‘order’, ‘ASC’); $query->set(‘orderby’, ‘title’); } add_action(‘elementor/query/queryCorrugatedStudios’, ‘corrugated_studios_query’); do_action( ‘qm/debug’, ‘[StudioHelpers] Registered’ );Continue reading