WordPress cron running twice

I tried WP Crontrol instead and it turned out that two cron jobs were being created for generate_send_csv. To fix this, I created the crons within activation hooks and deactivation hooks as follows: register_activation_hook( __FILE__, ‘my_activation’ ); add_action( ‘generate_send_csv’, ‘generate_and_send_csv’ ); function my_activation() { wp_schedule_event(‘1488979800’, ‘daily’, ‘generate_send_csv’); } register_deactivation_hook( __FILE__, ‘my_deactivation’ ); function my_deactivation() { … Read more

Woocommerce how to update variable product price programitically?

I believe you want the woocommerce_variable_price_html filter hook. But there are several price related filters listed in the official docs here: WooCommerce Api Docs: Hooks woocommerce_variable_price_html in 3.0 is defined in /class-wc-product-variable.php https://docs.woocommerce.com/wc-apidocs/source-class-WC_Product_Variable.html#145 Hooking it with something like: add_filter( ‘woocommerce_variable_price_html’, ‘NAME_OF_YOUR_FUNCTION’, 10, 2 ); Here is some Additional info on Filter Hooks in WordPress There … Read more

Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?

There is no reason for your design, but the core of your problem is that (I assume) people are trying to use a free tier of the API instead of properly paying for its use and removing the ridiculous restrictions. Anyway, the solution is fairly simple, run your cron every half an hour, allocate to … Read more

Plugin: Relative URL to images in another folder accessed inside a JS file

For this purpose you can use wp_localize_cript() function, like this: function localize_my_script() { $image_url = plugins_url( ‘resources/images/myimage.png’, __FILE__ ); $localizations = array( ‘imageURL’ => $image_url ); wp_localize_script( ‘my-script-handle’, ‘localizedVars’, $localizations ); } add_action( ‘wp_enqueue_scripts’, ‘localize_my_script’ ); That is assuming that you have properly enqueued your script with my-script-handle handle as an example.

why creating tables using $wpdb is not being executed while installing plugins?

Try using a different method. WordPress fires a hook during plugin activation activate_yourplugin/filename.php. You can use this to create tables. function creating_order_tables() { if(!get_option(‘tables_created’, false)) { global $wpdb; $ptbd_table_name = $wpdb->prefix . ‘printtextbd_order’; if ($wpdb->get_var(“SHOW TABLES LIKE ‘”. $ptbd_table_name .”‘” ) != $ptbd_table_name ) { $sql=”CREATE TABLE exone( customer_id INT(20) AUTO_INCREMENT, customer_name VARCHAR(255), order_type VARCHAR(255), … Read more