Should I use wpdb prepare?

It’s best practice to always use prepare but the main use of it is to prevent against SQL injection attacks, and since there is no input from the users/visitors or they can’t effect the query then that is not an issue in your current example. But like I said before it’s best practice to use … Read more

Where do I put the code snippets I found here or somewhere else on the web?

Whenever you find a piece of code without clear installation instructions it is probably a plugin. The example you gave is a good one, because that is the most common case: add_action(‘template_redirect’, ‘remove_404_redirect’, 1); function remove_404_redirect() { // do something } To use such a snippet, put it into a plugin: Create a new file, … Read more

How to make a plugin require another plugin?

Thanks for the answers guys. Though both answers set me on the right path, none worked out of the box. So I’m sharing my solutions below. Method 1 – Using register_activation_hook: Create the Parent Plugin in plugins/parent-plugin/parent-plugin.php: <?php /* Plugin Name: Parent Plugin Description: Demo plugin with a dependent child plugin. Version: 1.0.0 */ Create … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)