How to create database table, add data, update and delete using wpdb via plugins?
Yes, it is possible to add, update and delete data in custom tables with a plugin. When you run your insert_data_into_table() function, what errors do you get?
Yes, it is possible to add, update and delete data in custom tables with a plugin. When you run your insert_data_into_table() function, what errors do you get?
You’re posting directly to formaction.php, as such WordPress is never loaded and so you do not have access to any of its API, including the database API stored in global $wpdb (which is causing the error). I’d recommend keeping everything in WordPress… and a useful method for form handling is using admin-post.php (if you’re familiar … Read more
All WordPress pre-installed style sheets can be found at: ../wp-admin/css/ – for stylesheets used in the admin ../wp-includes/css/ – for all other stylesheets which may also be used in the admin. As you can see the stylesheets which are available on the front-end are minimal, focussing mainly on: admin-bar TinyMCE editor (which is available on … Read more
Simply register an additional sub-admin page for your plugin More info here. Then perform a wp_remote_request() to fetch the data. Loop through the results, display it in some sort of view for the end user – for e.g. a WP_List_Table and save your post types. Name the admin sub menu entry “Updates” and you’re done. … Read more
Some of caching APIs in WordPress, including transients, can make use of swappable Object Cache backend. There are ready-made implementations around for it which use file system as storage engine. However determining if it’s worth it is another matter entirely. In usual case database is very likely to outperform disk for typical caching tasks. However … Read more
You cannot add something on the same line, but right after the permalink box is an action: edit_form_after_title. See How do I position meta_box on post edit screen after the title? for an example. Also, you don’t even know if there is enough room for a second box on the permalink line. There are other … Read more
The default for reverse_top_level is null. Now let’s take a look at the function source: if ( null === $r[‘reverse_top_level’] ) $r[‘reverse_top_level’] = ( ‘desc’ == get_option(‘comment_order’) ); As you can see, it takes the value from the comment_order option. And that is either desc or asc. If the value is desc, then it will … Read more
You should be able to generate discount codes within your callback function by using the edd_add_discount() function. You can learn more about this function here on the EDD Codex to see what specific data you need to pass to the function. However, edd_complete_purchase might not be the right action to hook to. If you only … Read more
I assume you have hooked into manage_users_columns. Probably your array_merge is causing the problem. Instead of using $new_columns as the 1st parameter, use it as the 2nd as given below. $new_columns = array_merge ( $columns, $new_columns );
I figured it out. I needed to have a single value for $option_group across all register_settings and settings_fields. It’s working now.