Errors when trying to use a plugin to write to the database

You should never have to read wp-config to get database credentials. WordPress has built-in functions which are generally more secure for this sort of operation. In your plugin, simply call global $wpdb; and you will be connected to the WP database. You can then perform whatever queries you need – select, update, add, etc. For … Read more

Trouble with very basic plugin creation

When enqueuing JavaScript or CSS from a plugin’s directory, use plugin_dir_url( __FILE__ ). Note that plugin_dir_url() does return the URL with a trailing slash, unlike get_template_directory_uri() and get_stylesheet_directory_uri() which do not return the URL with a trailing slash. get_template_directory_uri() and get_stylesheet_directory_uri() are more commonly used in themes and child themes respectively. Here is an updated … Read more