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

Apache Redirect based on WordPress permissions

What you’re describing is likely best done in a simple WordPress plugin. You’re user roles are already stored in WordPress, so a plugin to do this is likely only a few lines long. Also an existing plugin like File Away may accomplish what your attempting. This plugin surfaced when I did a plugin search for … Read more

Sql query returns empty. But not

If you can answer ‘yes’ to the questions in Emetrop’s comment, then try: $sql = $wpdb->get_results(‘SELECT * from table1 WHERE id = $bransId’);