Create Tables in WordPress

Since you are a first timer (Welcome to the WordPress World, by the way) an easy way to achieve that is using plugins. For forms, I recommend Contact Form 7 (https://wordpress.org/plugins/contact-form-7/). It will allows you to create almost any type of form. To record the data into database and display as table, you can use … Read more

Query does not filter duplicate _sku numbers

I haven’t tested this, but this should give you the count of skus for each post_id: SELECT post_id, COUNT(`post_id`) AS sku_count FROM `wp_postmeta` WHERE `meta_key` LIKE ‘%sku%’ GROUP BY `post_id` To have it return only rows where the count is greater than one is trickier. Off the top of my head I’d probably use the … Read more

Use custom query if main search query returns zero results in wordpress

Exactly right about resetting it! You should use wp_reset_query(). Try this: $num_res = $wp_query->post_count; $get_search_term = get_search_query(); // No more work required for the query, so… wp_reset_query(); if($num_res == 0) { $args = array( ‘post_type’ => ‘resources’, ‘meta_key’ => ‘resource_txt’, ‘meta_value’ => $get_search_term, ‘meta_compare’ => ‘LIKE’ ); $custom_query = new WP_Query( $args ); // Do … Read more

Mysql Queries per Visit – Crazy High

It goes against the grain here to recommend plugins but that’s what you need here. To view in the browser; https://wordpress.org/plugins/query-monitor/ To view in WP-CLI; https://runcommand.io/wp/query-debug/ Both of these will list the queries and how long each one takes. That should give you enough information to make informed decisions about what to do in your … Read more