सीधे कंटेंट पर जाएं
Tools

सर्च और रिप्लेस SQL

सीरियलाइज़्ड डेटा को खराब किए बिना अपना साइट URL बदलें

आपके browser में चलता है. कुछ भी upload नहीं होता.

The change

Read this before you run anything

WordPress stores many options as PHP-serialized strings, and a serialized string records its own byte length — s:19:"http://old-site.com". A plain SQL replace changes the text but not the length, so PHP can no longer unserialize the row. It does not error. The value just silently becomes empty.

What you lose: widget configuration, theme mods, and most plugin settings. Usually you do not notice until days later, and by then the backup you would have restored is gone too.

This is why the queries below deliberately do not touch wp_options.

What are you moving?
search-replace.sql

Take a database backup first. Not 'consider taking one' — take one. There is no undo for an UPDATE.

सर्च और रिप्लेस SQL के बारे में

WordPress डेटाबेस पर बिना सोचे-समझे किया गया SQL फ़ाइंड-एंड-रिप्लेस हर उस सीरियलाइज़्ड ऑप्शन को खराब कर देता है जिसे वह छूता है, क्योंकि स्टोर की गई स्ट्रिंग की लंबाई अब मेल नहीं खाती। यह वे क्वेरी जनरेट करता है जो सुरक्षित हैं, और ठीक-ठीक समझाता है कि कौन-सी नहीं हैं।

मिलते-जुलते

दूसरे tools जिनकी आपको ज़रूरत पड़ सकती है

FAQ

सवाल

क्या मैं SQL find and replace से अपनी WordPress site URL बदल सकता हूँ?

सुरक्षित तरीके से नहीं, और यह WordPress में सबसे ज़्यादा शेयर की जाने वाली ग़लत सलाह है. कई options PHP-serialized strings के रूप में स्टोर होते हैं जो अपनी byte length खुद record करते हैं. एक सादा SQL replace text बदल देता है पर length नहीं, इसलिए PHP उस row को unserialize करने में चुपचाप fail हो जाता है और value बस गायब हो जाती है — अपने साथ widget settings, theme mods और plugin config ले जाकर.

मुझे इसके बजाय क्या इस्तेमाल करना चाहिए?

WP-CLI: पहले 'wp search-replace old new --all-tables --dry-run', फिर --dry-run के बिना. यह serialization को समझता है और length prefixes को सही से rewrite करता है. अगर आपके पास CLI access नहीं है, तो Better Search Replace plugin admin से वही काम करता है.

क्या मुझे GUID column update करना चाहिए?

नहीं. GUID किसी post के लिए एक स्थायी unique identifier है, कोई link नहीं, और feed readers इसी के आधार पर काम करते हैं. इसे rewrite करने से हर subscriber को हर पुरानी post एकदम नई दिखने लगती है. WordPress documentation साफ़ कहती है कि इसे न बदलें.