Checking if the data already exsis in the wp database – custom plugin

You can improve your code a lot. I’ll treat the email address as the student’s unique identification, since I can definitely have 2 students named ‘John Doe’. global $wpdb; $tablename = $wpdb->prefix.”students”; if(isset($_POST[‘submit’])){ $name = esc_attr($_POST[‘firstname’]); $surname = esc_attr($_POST[‘lastname’]); $email = sanitize_email($_POST[’email’]); if(!is_email($email)) { //Display invalid email error and exit echo ‘<div class=”error”><p>Invalid e-mail!</p></div>’; //return … Read more

#1115 – Unknown character set: ‘utf8mb4’

WordPress does not support MySQL 4 : To run WordPress your host just needs a couple of things: MySQL version 5.0 or greater (recommended: MySQL 5.5 or greater) https://wordpress.org/about/requirements/ While the utf8mb4 encoding is recent change and you might work around it, overall you still need compatible MySQL version.

Saving custom term value to the database in new table

short exmaple how i do it… (tables naming not really correct.) in this example i am trying to save _description $_POST variable. add_action ( ‘edited_term’, ‘custom_edited_term’, 10, 3); function custom_edited_term($term_id, $tt_id, $taxonomy){ if ( defined(‘DOING_AJAX’) || defined(‘DOING_CRON’) ) return; $_POST = stripslashes_deep($_POST); if (isset($_POST[‘_description’]) && trim($_POST[‘_description’]) != ”){ update_term_meta($term_id, ‘_description’, trim($_POST[‘_description’])); } else { delete_term_meta($term_id, … Read more

Create a new table on the database and save parameters from a contact form

I suggest for you some ideas : Before run functions from you make, you register table database store ( Example WP_IP and WP_UTM ) After create 2 table that, you run function of you You need read on Codex some resource on WP working with parameters : https://codex.wordpress.org/Class_Reference/wpdb https://codex.wordpress.org/Creating_Tables_with_Plugins