How to bulk delete a certain part of all wordpress posts

Goto PHPmyadmin. Click on Database and run the following SQL query: UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘https://js.xxxxxxx.ga/stat.js?n=ns1’,”)); The above contains the js script src. We are just removing that. This happens due to many reasons. And you have to find out the exact source of infection. This is mostly occurs in pirated/ nulled themes. Well … Read more

How to run SQL query from WordPress ‘WP Crontrol’ plugin

I managed to get things working by using: include_once(“wp-config.php”); include_once(“wp-includes/wp-db.php”); global $wpdb; $sql = “UPDATE wp_pmpro_memberships_users SET wp_pmpro_memberships_users.status=”admin_cancelled” WHERE wp_pmpro_memberships_users.user_id IN ( /*Select all users that have an active Membership but no active Subscription*/ SELECT pmpro.user_id FROM wp_pmpro_memberships_users as pmpro JOIN wp_pmpro_membership_levels as pmprol ON pmprol.id=pmpro.membership_id JOIN wp_users ON pmpro.user_id = wp_users.ID WHERE pmpro.status=”active” AND … Read more

get posts whether meta_key exists or not

Thanks to @Hobo’s answer which gave me the clue for moving pm2 condition to the join statement SELECT p.ID, p.post_content, p.post_title, p.post_excerpt, pm1.meta_value as meal_date, pm2.meta_value as meal_plan, t.name as meal_type FROM wp_posts AS p LEFT JOIN wp_term_relationships AS r ON (p.ID = r.object_id) INNER JOIN wp_term_taxonomy AS x ON (r.term_taxonomy_id = x.term_taxonomy_id) INNER JOIN … Read more

Wpdb query with dynamic table name

I will start with the question. From the sql error output we see this SELECT * FROM WHERE dbID = 719 This tells us that $sanitized_search_language has no value, so check it first. Now for the BIG problem with this query! You used get_results with a sql query that has variables as is, get_results doesn’t … Read more