Better Search Replace

Описание

При переносе вашего сайта WordPress на другой домен или сервер, скорее всего нужно сделать замену в БД чтобы все работало корректно. К счастью есть несколько плагинов для этой задачи, но они различаются подходом и ключевыми возможностями. Этот плагин объединяет лучшие возможности и предоставляет следующее в одном простом плагине:

  • Возможности сериализации для всех таблиц
  • Возможность выбора только отдельных таблиц
  • Возможность «холостого запуска» чтобы посмотреть как много полей будет обновлено
  • Нет дополнительных требований к серверу, кроме как работающая установка WordPress
  • Поддержка мультисайта

Функции для экономии времени, доступные в версии Pro:

  • View exactly what changed during a search/replace
  • Backup and import the database while running a search/replace
  • Приоритетная поддержка по электронной почте от разработчика плагина
  • Save or load custom profiles for quickly repeating a search/replace in the future
  • Support and updates for 1 year

Узнать больше о Better Search Replace Pro

The search and replace functionality is heavily based on interconnect/it’s great and open-source Search Replace DB script, modified to use WordPress native database functions to ensure compatibility.

Поддерживаемые языки

  • Английский
  • Французский
  • Немецкий
  • Испанский

Хотите внести свой вклад?

Feel free to open an issue or submit a pull request on GitHub.

Скриншоты

  • Страница поиска-замены добавлена в меню «Инструменты»
  • After running a search/replace dry-run.

Установка

Install Better Search Replace like you would install any other WordPress plugin.

Dashboard Method:

  1. Login to your WordPress admin and go to Plugins -> Add New
  2. Type «Better Search Replace» in the search bar and select this plugin
  3. Click «Install», and then «Activate Plugin»

Upload Method:

  1. Unzip the plugin and upload the «better-search-replace» folder to your ‘wp-content/plugins’ directory
  2. Активируйте плагин на странице Плагины админки WordPress

Часто задаваемые вопросы

Using Better Search Replace

Once activated, Better Search Replace will add a page under the «Tools» menu page in your WordPress admin.

Is my host supported?

Да! Этот плагин должен быть совместим с любым хостом.

Can I damage my site with this plugin?

Yes! Entering a wrong search or replace string could damage your database. Because of this, it is always adviseable to have a backup of your database before using this plugin.

How does this work on WordPress Multisite?

When running this plugin on a WordPress Multisite installation, it will only be loaded and visible for Network admins. Network admins can go to the dashboard of any subsite to run a search/replace on just the tables for that subsite, or go to the dashboard of the main/base site to run a search/replace on all tables.

Как я могу использовать этот плагин при смене URL-адресов?

If you’re moving your site from one server to another and changing the URL of your WordPress installation, the approach below allows you to do so easily without affecting the old site:

  1. Backup the database on your current site
  2. Install the database on your new host
  3. On the new host, define the new site URL in the wp-config.php file, as shown here
  4. Log in at your new admin URL and run Better Search Replace on the old site URL for the new site URL
  5. Delete the site_url constant you added to wp-config.php. You may also need to regenerate your .htaccess by going to Settings -> Permalinks and saving the settings.

More information on moving WordPress can be found here.

Отзывы

13.07.2024 1 ответ
Seriously?! This really got me some headaches. You don’t seem to test your tool properly. Dry run is the default option, I love it! But also checking the box above (replace GUIDs) overrules this dry run option silently! It’s still checked, but the tool will change your actual database! Unacceptable.
09.06.2024
Its a bait & switch. They say nothing in their «free» version description about there even being a paid version. All the free version will tell you is how many replacements will happen. But it won’t show you what they are. So its not safe to use, and their description is misleading.
09.06.2024
I just used this tool. At first it failed to replace links within my WordPress Elementor templates, within pages, and in the global footer for my site. Also, the URLs of the templates were still tied to the old website address and were still giving me a «file not found»when I clicked on them in my Elementor template list to try to edit them. I downloaded my templates and looked at the content of the JSON file of a template with a text editor. I found that its URLs were stated this way: oldwebsite.com\/directoryname (with a back slash and forward slash instead of just a forward slash). So I re-ran this plugin to search for that string and replace it with newwebsitename.com. That worked for changing the links in pages and the global footer. However, the problem with opening a template changed from file not found to it now won’t load. Working on that.
26.05.2024
This plugin gets the job done as described. The progress indicator bar is a good feature. Search result details are only available in paid version.
Посмотреть все 522 отзыва

Участники и разработчики

«Better Search Replace» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:

Участники

«Better Search Replace» переведён на 29 языков. Благодарим переводчиков за их работу.

Перевести «Better Search Replace» на ваш язык.

Заинтересованы в разработке?

Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.

Журнал изменений

1.4.7 — May 30, 2024

  • Fix: The case-insensitive setting once again allows case-insensitive strings to be matched within serialized data, fixing a regression introduced in version 1.4.6

1.4.6 — April 17, 2024

  • Changed: Serialized text strings are now only deserialized when containing a match, resulting in faster performance
  • Security: Table names are now escaped when displaying search results

1.4.5 — January 18, 2024

  • Security: Unserializing an object during search and replace operations now passes 'allowed_classes' => false to avoid instantiating the object and potentially running malicious code stored in the database (thanks to Wordfence for responsible disclosure on December 18, 2023 followed by development and testing of the fix by WP Engine)
  • Fix: A regression in version 1.4.4 which caused some search results to be skipped has been fixed to ensure only numeric keyed objects are skipped

1.4.4 — December 14, 2023

  • Fix: Objects with numerical properties are now skipped to avoid causing errors

1.4.3 — September 5, 2023

  • New: Links to plugin documentation, support, feedback, and changelog are now available in the footer of WP Admin
  • Improvement: PHP 8.2 and Better Search Replace are now compatible

1.4.2 — January 11, 2023

  • Security: Arbitrary tab templates in the templates directory can no longer be loaded using a query parameter.

1.4.1 — July 25, 2022

  • Security: Selected tables are now confirmed to exist before processing the request

1.4 — April 7, 2022

  • New: Better Search Replace has a brand new user interface
  • Improvement: Default capability required to use the plugin has changed from «install_plugins» to «manage_options» for compatibility with DISALLOW_FILE_MODS

1.3.4 — December 7, 2020

  • Improvement: WordPress 5.6 and PHP 8 compatible
  • Fix: Strings that have been serialized twice showing up as false-positives

1.3.3 — February 26, 2019

  • Fix: Some special characters interfering with search/replace
  • Security: Pass template filenames through sanitize_file_name()
  • Security: Verify nonce when downloading diagnostic info

1.3.2 — January 3, 2018

  • Fix: Only one table searched on some environments (props @Ov3rfly)
  • Tweak: Update text in sidebar

1.3.1 — September 14, 2017

  • Security: Check if data is serialized before unserializing it
  • Improvement: Increased size of table select

1.3 — November 10, 2016

  • Improvement: Updated sidebar and added pro version discount
  • Fix: Outdated links to old website
  • Fix: Prevent requests to invalid tabs

1.2.10 — June 2, 2016

  • Fix: CSS not loaded on details page

1.2.9 — December 8, 2015

  • Fix: Bug with case-insensitive searches in serialized objects
  • Fix: Bug with early skip due to lack of primary key

1.2.8 — November 25, 2015

  • Fix: Bug with report details

1.2.7 — November 24, 2015

  • Fix: Untranslateable string
  • Tweak: Check BSR_PATH instead of ABSPATH to be consistent
  • Tested with 4.4

1.2.6

  • Removed unused code/small cleanup

1.2.5

  • Improved progress bar info and styles
  • Small cleanup

1.2.4

  • Добавлено уведомление «Настройки сохранены» при сохранении настроек
  • Fixed bug with wp_magic_quotes interfering with some search strings

1.2.3

  • Fixed bug with searching for backslashes
  • Fixed potential bug with getting tables in large multisites
  • Fixed potential notice in append_report
  • Improved handling of missing primary keys

1.2.2

  • Fixed AJAX conflict with WooCommerce
  • Fixed a few issues with translations
  • Tweaked «System Info» to use get_locale() instead of WP_LANG constant
  • Updated German translation (props @Linus Ziegenhagen)

1.2.1

  • Fixed minor issue with display of progress bar
  • Updated translation file

1.2

  • Switched to AJAX bulk processing for search/replaces
  • Decreased minimum «Max Page Size» to 1000
  • Добавлена вкладка «Помощь» с информацией о системе для облегчения поиска и устранения неисправностей

1.1.1

  • Добавлена возможность изменения максимального размера страницы
  • Decreased default page size to prevent white screen issue on some environments

1.1

  • Добавлена возможность изменения возможностей, необходимых для использования плагина
  • Small bugfixes and translation fixes

1.0.6

  • Added table sizes to the database table listing
  • Добавлен перевод на французский язык (props @Jean Philippe)

1.0.5

  • Added support for case-insensitive searches
  • Added German translation (props @Linus Ziegenhagen)

1.0.4

  • Potential security fixes

1.0.3

  • Fixed issue with searching for special characters like ‘\’
  • Fixed bug with replacing some objects

1.0.2

  • Fixed untranslateable strings on submit button and submenu page.

1.0.1

  • Fixed issue with loading translations and added Spanish translation (props Eduardo Larequi)
  • Fixed bug with reporting timing
  • Updated to use «Dry Run» as default
  • Added support for WordPress Multisite (see FAQs for more info)

1.0

  • Релиз первой версии плагина.