Custom Plugin – CSS works, JS doesn’t

Would you please try below code to your plugin page. if the script file is your plugin root directory. function plugin_adding_scripts() { wp_register_script(‘my_test_script’, plugins_url(‘testscript.js’, __FILE__), array(‘jquery’),’1.1′, true); wp_enqueue_script(‘my_test_script’); } add_action( ‘wp_enqueue_scripts’, ‘plugin_adding_scripts’ ); Also: http://blog.aztora.com/add-css-js-into-wordpress-plugin/

Alternative functions for mysql_free_result and mysql_ping in wordpress functions

You have the following methods of the $wpdb object: $wpdb->flush() that contains a call to mysqli_free_result() or mysql_free_result() if not supported. $wpdb->check_connection() that contains a call to mysqli_ping() or mysql_ping() if not supported. You can of course use all your PHP functions in WordPress. Here’s an example based on the \wpdb class itself: // Use … Read more

Return Value of load_plugin_textdomain

global $langOK; add_action( ‘plugins_loaded’, ‘myplugin_load_textdomain’ ); function myplugin_load_textdomain() { global $langOK; $langOK = load_plugin_textdomain( ‘my-plugin’, false, dirname( plugin_basename( __FILE__ ) ) . ‘/languages’ ); } Later you can check the value of $langOK ( TRUE = success, FALSE = failure ).

zip unzip attachments in wordpress

WordPress provides a function called unzip_file()— easily found by typing “wordpress unzip” into Google. There is sample code in the Codex: WP_Filesystem(); $destination = wp_upload_dir(); $destination_path = $destination[‘path’]; $unzipfile = unzip_file( $destination_path.’/filename.zip’, $destination_path); if ( $unzipfile ) { echo ‘Successfully unzipped the file!’; } else { echo ‘There was an error unzipping the file.’; } … Read more

update_option_{$option} not showing old value

You should use pre_update_option_{option_name} filter. Example:- function system_save_number( $new_value, $old_value ) { mail(‘[email protected]’,’here’,print_r($old_value ,true) . “\n\n” . print_r($new_value,true)); return $new_value; } function system_init_actions() { add_filter( ‘pre_update_option_system_number’, ‘system_save_number’, 10, 2 ); } add_action( ‘init’, ‘system_init_actions’ );

why update option is not working?

update_option(‘acp_cf_settings’ , array(‘acp_cf_status’=>$resp[‘status’])); update_option(‘acp_cf_settings’ , array(‘acp_cf_log’=>$resp[‘log’])); You are overwriting the setting. After the second update_option call there is no acp_cf_status key anymore for the array variable, just the acp_cf_log. Just to be clear, you would need something like this: update_option( ‘acp_cf_settings’, array( ‘acp_cf_status’ => $resp[‘status’], ‘acp_cf_log’ => $resp[‘log’], ) );