How to delete all records from or empty a custom database table?
I would just modify Q Studio example to: global $wpdb; $table = $wpdb->prefix . ‘table_name’; $delete = $wpdb->query(“TRUNCATE TABLE $table”);
I would just modify Q Studio example to: global $wpdb; $table = $wpdb->prefix . ‘table_name’; $delete = $wpdb->query(“TRUNCATE TABLE $table”);
You have to include wpadmin/upgrade-functions.php file to create a table example function create_plugin_database_table() { global $table_prefix, $wpdb; $tblname=”pin”; $wp_track_table = $table_prefix . “$tblname “; #Check to see if the table exists already, if not, then create it if($wpdb->get_var( “show tables like ‘$wp_track_table'” ) != $wp_track_table) { $sql = “CREATE TABLE `”. $wp_track_table . “` ( … Read more
Update 2020 Answer See flytech’s answer for a solution using the native WooCommerce API. Note / Caveat If you’re going to do proper arithmetic with monetary values, always use signed integers (!) representing the smallest denomination of a given currency (Cent, Penny, Paisa, Dirham, e.g.). Only convert back to decimal fractions in the presentation layer … Read more
Since the question is tagged woocommerce, i’m assuming that it’s a product CPT created by woocommerce wordpress plugin. This answer doesn’t apply if that’s not the case. The products categories is not normal categories, they are a custom taxonomy created specifically for products which is just labeled as “Categories”. You should go through the woocommerce … Read more
To always get latest plugin take for example my plugin: http://wordpress.org/extend/plugins/wordpress-file-monitor-plus/ the download link for the latest is: http://downloads.wordpress.org/plugin/wordpress-file-monitor-plus.1.1.zip but if you remove the version from the download link you always get the latest version: http://downloads.wordpress.org/plugin/wordpress-file-monitor-plus.zip EDIT: Have you considered keeping a folder of the latest wordpress and plugins unpacked? Then as soon as a … Read more
You can customize or change WordPress image sizes using this function: http://codex.wordpress.org/Function_Reference/add_image_size <?php add_image_size( $name, $width, $height, $crop ); ?> The $crop parameter can be set to false for proportional or true for hard crop (it will hard crop from the center). If you use this function on already existing images you will need to … Read more
I’ve did a quick test on just changing the option and it seems to work. What I did is: Wrote a widget that has just 2 fields: “Title” and “Name”. Add several instances of this widget to my sidebars. Been sure that they are shown correctly in frontend. Edited the class to use 3 fields: … Read more
Consider plugin A: $A_message; add_action(‘plugins_loaded’, function() { do_action(‘plugin-A:init’); }); // Hooks allow B to access A (both during initialization of A and elsewhere in WordPress) without having to check if A exists. add_filter(‘plugin-A:set’, function($msg) { $A_message = $msg; }, PHP_INT_MAX); add_filter(‘plugin-A:get’, function($msg) { return $A_message; }, PHP_INT_MIN); Now, consider plugin B: add_action(‘plugin-A:init’, function() { // … Read more
You have to replace the call to BBpress’ language file. A good place to do this is a language specific file in your general languages directory. For Turkish it would probably be a file named tr_TR.php. This will be loaded automatically and only if it matches the language of your blog. It will not be … Read more
The first error message means that there is restrictions in place on where you can include files from, set by the server. You could try with require_once ABSPATH . ‘/wp-content/plugins/pluginname/pluginfunctions.php’; but I’m not sure if it would work. With the second include you’re trying to include an URL which is disabled by the server for … Read more