How To Override A WooCommerce AJAX Function

Ok, so I don’t know if this is the best way, but it’s working for now. Within my OOP class (I have a custom plugin to override a WC plugin): remove_action( ‘wp_ajax_wc_function’, array( WC_Parent_Class, ‘wc_do_stuff’ ) ); remove_action( ‘wp_ajax_nopriv_wc_function’, array( WC_Parent_Class, ‘wc_do_stuff’ ) ); add_action( ‘wp_ajax_wc_function’, array( __CLASS__, ‘my_override_do_stuff’ ) ); add_action( ‘wp_ajax_nopriv_wc_function’, array( __CLASS__, … Read more

Replacement for gallery_shortcode function not taking all attributes

<?php function modified_post_gallery( $blank = NULL, $attr ) { echo ‘<pre>’; print_r( $attr ); echo ‘</pre>’; } add_filter( ‘post_gallery’, ‘modified_post_gallery’, 10, 2); ?> In media.php it shows the filter like this: // Allow plugins/themes to override the default gallery template. $output = apply_filters(‘post_gallery’, ”, $attr); Its passing two variables not one and $attr is on … Read more

url – ajax loaded but no JS

Try this code in your complete callback of the load function: $(“.postbox_wrapper”).load( jQuery(this).attr(“href”) + ” .postbox_wrapper”, function(response, status, xhr) { // complete callback // create a empty div var div = document.createElement(‘div’); // fill div with response div.innerHTML = response; // take correct part of the response var ref = $($(div).find(‘.postbox_wrapper’).html()); // filter response for … Read more

Website Warning: call_user_func_array() expects parameter 1 to be a valid callback, class ‘Wppr_Public’ does not have a method ‘amp_support’

The warning message is pretty clear. You’re passing method amp_support from class Wppr_Public as callback, but this class doesn;t have such method… So how to fix it? You should find that class and look for this function. Maybe it’s some typo or that method changed its name or moved to another class or something like … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)