Create a stored procedure on plugin activation

As an example, let’s say you were planning on the following stored procedure: SELECT * FROM wp_posts Instead of actually stashing this inside MySQL, let’s create a PHP function: function {plugin_prefix}_get_posts() { global $wpdb; return $wpdb->get_results( “SELECT * FROM $wpdb->posts” ); } Now we can call this whenever we need it: $posts = {plugin_prefix}_get_posts(); // … Read more

$wpdb post type and term query only works when there are no dashes or spaces in the term slug and title

In your code you are using “AND terms.name=”shorelineorwaterway” where I don’t think shorelineorwaterway is your term name, it could be your terms slug. So you can modify this by “AND terms.slug = ‘shorelineorwaterway’ and here inside inverted commas you can use hyphen. If you need to use term name then “AND terms.name=”Your Term Name” would … Read more

Update user_email via php – WP 4.7

I got it to work using $wpdb->update: $ID = $current_user->ID; $email = sanitize_email($_POST[’email’]); $wpdb->update($wpdb->users, array(‘user_email’ => $email), array(‘ID’ => $ID)); Not exactly sure what the issue was with wp_update_user unfortunately.

wont add form details to database or send me mail

/** * Since the install of WP-Mail-SMTP we need to make sure the FROM is the same as the one specified in the plugin * These filters will overwrite any FROM send by other plugins. */ add_filter(‘wp_mail_from’,’custom_wp_mail_from’); function custom_wp_mail_from($email) { return get_option(‘mail_from’); } add_filter(‘wp_mail_from_name’,’custom_wp_mail_from_name’); function custom_wp_mail_from_name($name) { return get_option(‘mail_from_name’); } Might be this will help … Read more

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