Skip to content

Instantly share code, notes, and snippets.

@stonecorleone
Forked from solancer/apache-nginx-ftp
Last active July 9, 2020 15:47
Show Gist options
  • Save stonecorleone/04e9e94a2182bc9d595216049b574137 to your computer and use it in GitHub Desktop.
Save stonecorleone/04e9e94a2182bc9d595216049b574137 to your computer and use it in GitHub Desktop.
Correct permissions for /var/www/html
// Adding current user to www-data
sudo adduser $USER www-data
//change ownership to user:www-data and
sudo chown $USER:www-data -R /var/www/html
sudo chmod u=rwX,g=srX,o=rX -R /var/www/html
// change file permissions of existing files and folders to 755/644
sudo find /var/www/html -type d -exec chmod g=rwxs "{}" \;
sudo find /var/www/html -type f -exec chmod g=rws "{}" \;
# First:
DELETE FROM wp_postmeta
WHERE post_id IN
(
SELECT id
FROM wp_posts
WHERE post_type = 'attachment'
)
;
# Second:
DELETE FROM wp_posts WHERE post_type = 'attachment'
@stonecorleone
Copy link
Author

DELETE relations., taxes., terms.*
FROM wp_term_relationships AS relations
INNER JOIN wp_term_taxonomy AS taxes
ON relations.term_taxonomy_id=taxes.term_taxonomy_id
INNER JOIN wp_terms AS terms
ON taxes.term_id=terms.term_id
WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product');

DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'product');
DELETE FROM wp_posts WHERE post_type = 'product';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment