MySQL – How to combine data from two tables into one?

Syntax The issue with your WordPress approach is the get_var calls used to get the subscriber id and interest name. get_var is intended to get just a variable from the database like the number of rows in the table or sum of a numeric column in the table, see the WordPress Codex What your looking … Read more

Processing forms with php to wordpress database

I’m pretty sure you don’t quote the $variable at all when doing a query with wpdb. So ‘association_first_name’ => ‘$legalname’ would be ‘association_first_name’ => $legalname But that might not solve all your problems.

MySQL query in WordPress with AJAX

I would need to see your trigger function but it sounds like you just need to add event.preventdefault to the submit. This will block the page load while still executing AJAX. $(“form.searchCV_form”).submit(function(event){ event.preventDefault(); alert( “We’re not going anywhere now…” ); // j$.post… }); or $(“form.searchCV_form”).submit(function(e){ alert( “We’re not going anywhere now…” ); // j$.post… return … Read more

How to filter get_adjacent_post()?

Well it wasn’t too hard after some perspective. public function get_adjacent_post_mod($where){ if (is_single()){ global $wpdb, $post; if ( get_post_status ( ) == ‘private’ ) { $where = str_replace( “AND ( p.post_status=”publish” OR p.post_status=”private” )”, “AND p.post_status=”private””, $where ); return $where; } else { $where = str_replace( “AND ( p.post_status=”publish” OR p.post_status=”private” )”, “AND p.post_status=”publish””, $where … Read more

How to get Attachments(image) with specific width\height ratio

The _wp_attachment_metadata stores serialized data. It’s not meant to be used directly in queries to match results. Instead hook add_attachment action and store original image’s dimensions into separate post meta properties. After you’re happy with how it works follow Rarst’s advice and find a way to walk all existent image attachments and generate those meta … Read more

Weird characters displayed when importing WordPress MySQL db

Can you try setting the DB Charset within wp-config.php? define(‘DB_CHARSET’, ‘utf8_general_ci’); define(‘DB_COLLATE’, ‘utf8_general_ci’); Have a read of this first though: https://codex.wordpress.org/Editing_wp-config.php It can cause problems to an already existing blog to add those lines into wp-config.php, so use with caution. Are you importing this through WordPress or manually through something like PhpMyAdmin? Also, are all … Read more

WordPress Multisite with thousands of blog

The number of tables is not an issue by itself. Actually separating the tables for each blog make each operation related to a specific blog more performant. Your scaling problem will come more likely from the big monolithic users tables. Scaling issues will come from the amount of requests your DB will have to handle, … Read more

Remove Featured Image based on Date

@Romulus Since you are using WordPress, I would highly suggest using WordPress’ functionality as much as you can. I would recommend using PHP and creating your own plugin or some kind of script that you can run. There are lots of tutorials out there that will give you the bare-bones implementation for creating a simple … Read more