Delete all one-word comments

DISCLAIMER : Not a WordPress Developer, Just a MySQL DBA If you have privileges to login to MySQL and query data you could collect all the comment_ID values that have one word. SELECT comment_ID FROM wp_comments WHERE REPLACE(TRIM(comment_content),’ ‘,”)=TRIM(comment_content); You can test this by also seeing the comment_content SELECT comment_ID,comment_content FROM wp_comments WHERE REPLACE(TRIM(comment_content),’ ‘,”)=TRIM(comment_content); …

Read more

Delete All Product Images in phpmyadmin

You can loop through all the woo-commerce products and delete them along with their attachment(images).. $args = array( ‘post_type’ => ‘product’, … ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php wp_delete_post( $loop->post->ID ); wp_delete_attachment( $loop->post->attachment_id ); ?> <?php endwhile; ?>

Can’t find my wordpress DB in phpmyadmin

I don’t see any reason to login as root if you only need the one database… Have you tried logging in to phpMyAdmin as the user with the same credentials as your WordPress installation? user: bn_wordpress pass: 0cca6aaab5 port: 3306 We could avoid phpMyAdmin all together… From the command line you can dump the database …

Read more

Set meta_key and meta_value for all registered user in wordpress using sql query [closed]

Add this code in functions.php. visit your site you, it will automatic add/update all user meta value. After executing this code just comment out or remove this code. $args = array( ‘fields’ => ‘all’, ); $blogusers = get_users( $args); foreach($blogusers as $key => $user){ update_user_meta( $user->ID, ‘is_activated’, 1 ); } OR you can also do …

Read more

Delete WordPress posts from URL list sql query

Yes you can. To delete posts with inherit post meta, use following code: DELETE p,pm FROM wp_posts p JOIN wp_postmeta pm ON pm.post_id = p.id WHERE p.post_name IN (‘post-1’, ‘post-2’, ‘post-3’) Pass slugs array to WHERE clause. If you want to delete only posts w/out postmeta (for some reason), use this code: DELETE FROM wp_posts …

Read more