Batch replace WordPress custom column values

WordPress three 1.1K Reading mode

If the previously added custom column values, such as attachments or image link addresses, have changed, you can modify them in batches by using the following methods.

 Batch replace WordPress custom column values

Add the following code to the end of the current topic function template functions.php:

 global $wpdb; $wpdb->query("UPDATE wp_postmeta SET meta_value = replace( meta_value, ' https://www.baidu.com/ ',' https://down.baidu.com/ ')");

The above example is applicable to modifying only the domain name in the link address, not the link behind the domain name.

For example: https://www.baidu.com/2020/01/ file.zip

Replace with: https://down.baidu.com/2020/01/file.zip

Others can be deduced by analogy.

After adding code, refresh the web page and replace it.

Please backup the data before operation, just in case!

After replacement, please remove the above code.

Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!

 weinxin
My Wechat
Copyright Notice
Please indicate the source and link of the original article reprinted on this site. Thank you for your cooperation!
five hundred and ninety-eight million eight hundred and forty-five thousand and six
 
 Robin
five hundred and ninety-eight million eight hundred and forty-five thousand and six
Comments three    Visitors three
    •  simple life
      simple life four

      The sofa is mine again. According to my observation, Brother Bird has been struggling with the theme! I picked some! :mrgreen:

      •  Lvruan Bar
        Lvruan Bar five

        Thanks for sharing

        •  Ming
          Ming zero

          sure

         anonymous

        Comment

        Anonymous netizens
         :?:  :razz:  :sad:  :evil:  :!:  :smile:  :oops:  :grin:  :eek:  :shock:  :???:  :cool:  :lol:  :mad:  :twisted:  :roll:  :wink:  :idea:  :arrow:  :neutral:  :cry:  :mrgreen:

        Drag the slider to complete validation