Custom Fields
Re-Envisioned
Support General How to automatically replace text/url's in wp_postmeta

This topic contains 3 replies, has 2 voices, and was last updated by  Anh Tran 2 years ago.

  • Creator
    Topic
  • #4783

    MarketPress
    Participant

    Hello guys!
    I love the plugin and all the extensions so far. I have only one issue with the saved data in wp_postmeta. I would like to know if there is a way to automatically replace an url (for example) in this table. If i change any character of cloneable field inside the database table, the fields are empty in the backend after. My general workflow is to export the database and import it at the new system. Before importing i have to change the URL of the development system to the final URL. But after replacing the URLs, all the cloneable fields are empty in the backend. Is there a workaround for that behavior? For now i have to replace all URLs in the backend fields by hand.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #4795

    Anh Tran
    Keymaster

    Hi, the job of search and replace URL in the database is very common while migrating a WordPress site. You can do that in many ways in general, not specific for Meta Box by using:

    WordPress search and replace tool: this tool is one of the best tool to do this job with GUI

    WP-CLI search-replace command provides a same way to do that with command line. If you’re using Windows, you might want to follow this tutorial to install WP-CLI on Windows.

    Both tools allow you search and replace a string in the whole database or in a specific table (wp_postmeta).

    #4827

    MarketPress
    Participant

    Hi! Thanks for your reply. The search and replace process is working well, but if any character is changed in the table field of a cloneable field, the field is empty in the WordPress backend. So it seems like that the connection gets lost if there is a change in the table field. The content of the fields in the backend is returning if i undo my change in the database table field. How exactly is the connection between the table field and the backend field working? Thanks for your Help!

    #4846

    Anh Tran
    Keymaster

    Hi,

    If you change only the post meta value, then nothing happens. Please try search and replacing only on the column meta_value in the table wp_postmeta.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.