In WordPress you can save post custom information in the form of post meta.
SO I have saved to input fields value in one meta field in the form of serialized array like this.

a:2:{i:0;s:81:"http://sme.sabidoclick.com/sme/wp-content/uploads/2014/05/L-Mini-Instructions.pdf";i:1;s:85:"http://sme.sabidoclick.com/sme/test/wp-content/uploads/2014/05/L-Mini-Graphic-Template.pdf";

So as you can see in the string “i:0;s:81:” this “81” is the length of the next url.
and before transferring the site to new domain I have replaced the url in the database file now the url is changed and the new array is.

a:2:{i:0;s:81:"http://smedisplays.com/test/wp-content/uploads/2014/05/L-Mini-Instructions.pdf";i:1;s:85:"http://smedisplays.com/test/wp-content/uploads/2014/05/L-Mini-Graphic-Template.pdf";

So the url is changed but the length number “81” remains the same due to which the unserialize() function is not working properly.

Is there a quick way to solve it by code because I am having around 450 posts and every single post have this meta field.

Read more here: How to unserialize() data string when an url inside it is changed?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: