Ajax Call not Working in Plugin

You need to add the ajax callback action on your plugin file or themes functions.php like as below: add_action( ‘wp_ajax_fetch_data’, ‘fetch_data_callback’ ); add_action( ‘wp_ajax_nopriv_fetch_data’, ‘fetch_data_callback’ ); then you need to put all the featch_data.php code inside the callback function ‘fetch_data_callback’ like as below: function fetch_data_callback(){ //your function code goes here wp_die() // need to add … Read more

How to properly enqueue jQuery knob on WordPress without conflict?

If you want to just enqueue a script by name then you have to register it first with wp_register_script: wp_register_script( ‘jquery-knob’, plugins_url( ‘assets/js/jquery.knob.min.js’, __FILE__ ), array( ‘jquery’ ), ‘1.2.11’ ); : wp_enqueue_script( ‘jquery-knob’ ); However that’s only really useful when you’re registering a script to be available as a dependency for other scripts, which I … Read more

Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /../plugins/rm-payment.php

My guess is that you’re accessing $response as an array when it’s a \WP_Error. Check out the possible return values of wp_remote_post: (array|WP_Error) The response or WP_Error on failure. You should modify your code in a couple of ways: $response = wp_remote_post( $remote_url, $request ); if ( is_wp_error( $response ) ) { // handle the … Read more