How to return count number from a wordpress database
It is recommended to use the $wpdb->get_var() method when retrieving a count of rows. This method will return the count directly, rather than inside of an array or object like wpdb::get_results().
It is recommended to use the $wpdb->get_var() method when retrieving a count of rows. This method will return the count directly, rather than inside of an array or object like wpdb::get_results().
WordPress can only use the tables with the same prefix as listed in the wp-config.php file. Many times when a database has been used for sometime it will hold several version of the site in the same database by adding different table prefixes to the site versions. This is likely what you are seeing. It … Read more
This is what I wanted to achieve, I hope it helps somebody DELETE wp_posts FROM wp_posts INNER JOIN wp_users ON wp_posts.post_author = wp_users.ID WHERE post_author = 1 AND post_date BETWEEN ‘2024-01-01 00:00:00’ AND ‘2024-03-28 23:59:59’;
WordPress Admin login problems- PLEASE HELP [closed]
Drop this into a file in your plugin directory and you should be able to do this from your WP installation using a query string. /* Plugin Name: Delete Specific Post Description: Rid the post forever! Version: 0.1 Author: WPSE License: GPL2 */ add_filter(‘query_vars’, ‘delete_post_query_var’); function delete_post_query_var($vars){ $vars[] = ‘delete_post’; return $vars; } add_action(‘admin_init’, ‘manually_delete_post’, … Read more
You might have already done this, but while logged into the admin of your site, go to Settings > General and then review the urls in WordPress Address (URL) and Site Address (URL). If they do not read with the new domain name, then they need to be updated. Once you have the correct urls … Read more
finally I find right code with helping by ChatGPT DELETE p FROM wp_posts p INNER JOIN wp_term_relationships tr1 ON (p.ID = tr1.object_id AND tr1.term_taxonomy_id = 2) LEFT JOIN wp_term_relationships tr2 ON (p.ID = tr2.object_id AND tr2.term_taxonomy_id = 20) WHERE p.post_type=”post” AND p.post_status=”publish” AND DATEDIFF(NOW(), p.post_date) > 180 AND tr2.term_taxonomy_id IS NULL; Lets try another way … Read more
problem solving in website loading
This may not be the best solution. I am not an expert. But the following helped solve my problem and I can add columns using the PhpMyAdmin without getting any errors. I went over to the SQL tab and then I ran the following query show variables like ‘sql_mode’; Then in order to remove i … Read more
Help required with local wordpress setup