Skip to content

Instantly share code, notes, and snippets.

@lcherone
Last active January 2, 2021 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcherone/6446ee12eec32180c0300071a6e252e1 to your computer and use it in GitHub Desktop.
Save lcherone/6446ee12eec32180c0300071a6e252e1 to your computer and use it in GitHub Desktop.
manual wordpress serialize fixer
<?php
$str = 'a:1:{s:3:"foo";s:23:"https://beta.domain.com";}';
echo serialize(json_decode(str_replace('beta.domain.com', 'domain.com', json_encode(unserialize($str))), true));
// a:1:{s:3:"foo";s:18:"https://domain.com";}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment