Skip to content

Instantly share code, notes, and snippets.

@mino129
mino129 / restore-old-tooltips.php
Last active August 26, 2024 09:09
Restore the old tooltip functionality in WooCommerce (show order comments).
<?php
function add_old_order_status_tooltips( $status_names, $order ) {
$order_id = $order->get_id();
$order_status = wc_get_order_statuses();
remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
$comment_count = get_comment_count( $order_id );
add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
@mino129
mino129 / ajax_call.js
Last active January 26, 2023 16:24
WordPress Ajax Boilerplate
$.ajax({
type: "post",
dataType: "json",
url: ajaxRef.ajax_url,
data: {
action: "action_name",
nonce: ajaxRef.nonce,
},
success: function(msg){
console.log(msg);
@mino129
mino129 / disable_block_editor.php
Last active February 20, 2023 10:45
Disable WordPress block editor
/*
block editor for posts + widgets
*/
add_filter("use_block_editor_for_post", "__return_false", 10);
add_filter("use_widgets_block_editor", "__return_false" );
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );