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

option select form always deleting the sql query

Don’t tag your option as selected if you don’t want it selected, which means that you should probably be using selected() to dynamically select any value that has already been set. That should solve the problem. But this could be cleaned up a lot: esc_attr() accepts a single parameter. You are sending it two. It … Read more

Expired Post with More Recent Time Stamp?

I am pretty sure that what you are looking at are post revisions. The posts with status “expired” are the primary post. The ones with “inherit” are revisions or autosave. Look at the post_name column and you should see a pattern like **-autosave-** or **-autosave-**, and then look at the post_parent column and your “expired” … Read more

Problem in adding new site on WP multisite

The problem was solved in the next update of WordPress. By the way if you still haven’t updated your version of WordPress: It’s enough to set DB_COLLATE in the wp-config.php: define(‘DB_COLLATE’, ‘utf8mb4_general_ci’); // on condition that your DB_CHARSET is ‘utf8mb4′ That’s it! The bug is hidden in the file \wp-includes\wp-db.php on the line 731 in … Read more