WP showing “warning: call_user_func_array()”, What to do?

The error you’re getting is showing, because somewhere on your site (your theme or one of your plugins) is registering a filter function that doesn’t exist. Somewhere in your code, there will be such line (or similar to it): add_filter( ‘rewrite_rules_array’, ‘disable_embeds_rewrites’ ); It may use different hook, so it may also look like: add_filter( … Read more

How to check if which hook triggered the call to a function?

I found the magic code you need. Use current_filter(). This function will return name of the current filter or action. add_action(‘my_test_hook_1′,’my_test_callback_function’); add_action(‘my_test_hook_2′,’my_test_callback_function’); add_action(‘my_test_hook_3′,’my_test_callback_function’); add_action(‘my_test_hook_4′,’my_test_callback_function’); function my_test_callback_function(){ $called_action_hook = current_filter(); // ***The magic code that will return the last called action echo “This function is called by action: ” . $called_action_hook ; } For reference: https://developer.wordpress.org/reference/functions/current_filter/

Using a private method as an action callback from within a class

It’s not possible to call a private method through an action or filter. When calling add_action or add_filter, WordPress adds the callback to a list of callbacks for that specific action or filter. Then, when do_action or apply_filters is called, WordPress uses call_user_func_array to call the linked functions and methods. As call_user_func_array is not called … Read more

WordPress REST API – Permission Callbacks

The issue was because I wasn’t generating and sending a nonce value with the request. In order to generate a nonce value. Localize the value of a wp_create_nonce(‘wp_rest’) function call. wp_localize_script(‘application’, ‘api’, array( ‘root’ => esc_url_raw(rest_url()), ‘nonce’ => wp_create_nonce(‘wp_rest’) )); This will then be accessible to the window object of the browser which can be … Read more

Image upload callback in new 3.5 media

There is a FileUploaded event being fired in wp-includes/js/plupload/wp-plupload.js. Alternatively (and propably the better way) you may want extend wp.Uploader with your own success callback . (function($){ $.extend( wp.Uploader.prototype, { success : function( file_attachment ){ console.log( file_attachment ); } }); })(jQuery);