php - Remove "%" from strings in serialized arrays in MySQL database -


While running a script to capture the hot-linked images to blog and host the blog from Blogger, I ended up

Act% 252Bapandas-210x290.png

These image names prevent images from appearing on the webpage, due to url encoding file Name ends in (do not ask!) I have given them name on file server, no problem Is not, but the name also attaches metadata to each post.

How can I remove "%" from all image references in "code"? Wp_postmeta table? Most of them are in sorted arrays for meta_value s for meta_key s _wp_attachment_metadata . I had no luck finding the plug-in, and I am unsure how to set up a pure SQL solution.

Edit:

Commentators have said, this issue is changing or removing "%" character and To update the array so that it indicates the correct number of characters (like S: 13 point out yoursite.com 13 characters []) I'm also open to using a php solution ! Anything that can help me fix this mess

More solutions later

I have not really created this question in terms of wordpress question, I have prepared it, a SQL problem I answered Given accordingly. But I was able to solve this problem by default (with support from @). Here's how I solve the problem using the original WordPress functions within the loop: get_posts (array ('post_type' = & gt; 'attachment', 'numberposts '= & Gt; -1,)); Foreach ($ post $ as post) {/ data retrieve, automatically unserialized $ meta = get_post_meta ($ post-> ID, '_ wp_attachment_metadata', to search any 'through array' Loop 'and / / Update it back __ paste_post_meta ($ post- & gt; id,' _wp_attachment_metadata ', $ meta);}

These tasks are automatically recovered by you Or type the type of data that will be automatically recorded and if necessary it will be serialed (This might be). () And maybe_unserialize () are controlled by the internal use of functions.

I am sure that it is not possible to do it with the pure SQL due to the complexity of the serial array structure.

Comments