X

Enthüllt: Liste der beliebten WP MySQL-Snippets

Schnipsel von IsItWP

Eine Sammlung nützlicher MySQL-Snippets für WordPress, die aus verschiedenen Beiträgen im Internet gesammelt wurden.

# Change Siteurl & Homeurl
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';

# Change GUID
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com');

# Change URL in Content
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com');

# Change Image Path Only
UPDATE wp_posts SET post_content = REPLACE (post_content, 'src="http://www.oldsiteurl.com', 'src="http://yourcdn.newsiteurl.com');
UPDATE wp_posts SET  guid = REPLACE (guid, 'http://www.oldsiteurl.com', 'http://yourcdn.newsiteurl.com') WHERE post_type = 'attachment';

# Update Post Meta
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.oldsiteurl.com','http://www.newsiteurl.com');

# Change Default "Admin" Username
UPDATE wp_users SET user_login = 'Your New Username' WHERE user_login = 'Admin';

# Reset Password
UPDATE wp_users SET user_pass = MD5( 'new_password' ) WHERE user_login = 'your-username';

# Assign all articles by Author B to Author A
UPDATE wp_posts SET post_author = 'new-author-id' WHERE post_author = 'old-author-id';

# Delete Revision
DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision'

# Delete Post Meta
DELETE FROM wp_postmeta WHERE meta_key = 'your-meta-key';

# Export all Comment Emails with no Duplicate
SELECT DISTINCT comment_author_email FROM wp_comments;

# Delete all Pingbacks
DELETE FROM wp_comments WHERE comment_type = 'pingback';

# Delete all Spam Comments
DELETE FROM wp_comments WHERE comment_approved = 'spam';
#     * 0 = Comment Awaiting Moderation
#     * 1 = Approved Comment
#     * spam = Comment marked as Spam

# Identify Unused Tags
SELECT * From wp_terms wt INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id WHERE wtt.taxonomy='post_tag' AND wtt.count=0;

Hinweis: Wenn Sie zum ersten Mal Code-Schnipsel in WordPress hinzufügen, lesen Sie bitte unseren Leitfaden, wie Sie Code-Schnipsel richtig in WordPress hinzufügen, damit Sie Ihre Website nicht versehentlich beschädigen.

Wenn Ihnen dieser Code-Schnipsel gefallen hat, ziehen Sie bitte in Betracht, unsere anderen Artikel auf der Website zu lesen, wie z. B.: 11 beste WordPress-Quiz-Plugins und wie man beeindruckende WordPress-Optin-Formulare erstellt.

Kommentare   Hinterlasse eine Antwort

Kommentar hinzufügen

Wir freuen uns, dass Sie einen Kommentar hinterlassen haben. Bitte beachten Sie, dass alle Kommentare gemäß unserer Datenschutzrichtlinie moderiert werden und alle Links nofollow sind. Verwenden Sie KEINE Schlüsselwörter im Namensfeld. Lassen Sie uns ein persönliches und bedeutungsvolles Gespräch führen.

WordPress Launch Checkliste

Die ultimative Checkliste für den Start von WordPress

Wir haben alle wichtigen Checklistenpunkte für den Start Ihrer nächsten WordPress-Website in einem praktischen E-Book zusammengefasst.
Ja, senden Sie mir das kostenlose E-Book!