Title: Bug: Recursive replacement
Last modified: November 28, 2016

---

# Bug: Recursive replacement

 *  Resolved [getiem](https://wordpress.org/support/users/getiem/)
 * (@getiem)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/)
 * Hello Weblizar,
 * The current version of Seo Image Optimizer is replacing the alt and title tags
   good.
    Bug there is a loop bug/ recursive bug in this: For every extra image 
   in the post, it repeats the image title or tags in the alt text.
 * Example:
    Post with 4 images. 2 tags and 1 category Replacement is defined as:%
   tags, %category
 * Result is:
    image 1: alt = tag1, tag2, category1
 * image2:
    alt = tag1, tag2, category1, tag1, tag2, category1
 * image3:
    alt = tag1, tag2, category1, tag1, tag2, category1, tag1, tag2, category1
 * etc…
 * Loop on line 175 of option-panel.php contains an error. It adds the properties
   of the post to the existing variable every time the loop continues with every
   image.
 * Can you fix this?

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

 *  Thread Starter [getiem](https://wordpress.org/support/users/getiem/)
 * (@getiem)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-8489309)
 * Fixed it myself in my own site, Can you please update your code?
 * Fix to apply:
 * options-panel.php
    Add on line 207: _$alt\_text = ”;_
 * Add on line 212:
    _$title\_text = ”;_
 *  Plugin Support [weblizar_support](https://wordpress.org/support/users/weblizar_support/)
 * (@weblizar_support)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-8491566)
 * Thanks Getiem for the information,
 * We have fixed the issue and update the plugin.
 * Thanks
 * if you want to see more information about our plugin please visit documentation
   [link](https://weblizar.com/documentation/plugins/seo-images-optimizer-pro/)
 *  [ingrevallo](https://wordpress.org/support/users/ingrevallo/)
 * (@ingrevallo)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-8623557)
 * Hi,
 * I have installed the Version: 1.0.6 and I have the same issue, that getiem has
   reported.
 * Could you please help me?
 * Paulo
 *  [DanyelAndre](https://wordpress.org/support/users/danyelandre/)
 * (@danyelandre)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-8851384)
 * I have just downloaded and installed the actual version from the WP repository
   and the issue is still there. Would be nice to have it fixed.
 * I am using the Divi theme what is not fetching the image information used in 
   the media library automatically. That means, that title and alt have to be set
   manually when placing the image with the Divi Page Builder. So it would be nice
   to have the settings-option to chose the title and alt-information as saved in
   the media library (e. g. %img_title and %img_alt).
    -  This reply was modified 9 years, 3 months ago by [DanyelAndre](https://wordpress.org/support/users/danyelandre/).
    -  This reply was modified 9 years, 3 months ago by [DanyelAndre](https://wordpress.org/support/users/danyelandre/).
 *  Thread Starter [getiem](https://wordpress.org/support/users/getiem/)
 * (@getiem)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-8944262)
 * Indeed, in updates this issue is back.
 * Fixed it again in my own code. Please fix in repository too.
 * **At line 141 of option-panel.php, add two extra lines:
    $alt_text = ”; $title_text
   = ”;
 * Remark:
    Be sure to analyse the **scope** of your variables in the future. You
   are now looping on a variable and doing a recursive add with the .= on the variables.
   See lines: $alt_texts = $wl_wsio_options[‘wsio_alt_attribute_value’]; if ($alt_texts!
   =”){ foreach($alt_texts as $alt_texted){ $alt_text .= $alt_texted.’ ‘;} } $title_texts
   = $wl_wsio_options[‘wsio_title_tag_value’]; if ($title_texts!=”){ foreach($title_texts
   as $title_texted){ $title_text .= $title_texted.’ ‘;} }
 *  Plugin Author [Weblizar – WordPress Themes & Plugin](https://wordpress.org/support/users/weblizar/)
 * (@weblizar)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-8947144)
 * Thanks so much.
 * We will add this into nextupdate.
 *  Thread Starter [getiem](https://wordpress.org/support/users/getiem/)
 * (@getiem)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-9208274)
 * Please fix again, still in this update….
 *  Thread Starter [getiem](https://wordpress.org/support/users/getiem/)
 * (@getiem)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-9208284)
 * Fixed it myself on my local blog with my fix from post [https://wordpress.org/support/topic/bug-recursive-replacement/#post-8944262](https://wordpress.org/support/topic/bug-recursive-replacement/#post-8944262)
    -  This reply was modified 8 years, 11 months ago by [getiem](https://wordpress.org/support/users/getiem/).
 *  Thread Starter [getiem](https://wordpress.org/support/users/getiem/)
 * (@getiem)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-9421072)
 * Please, current version 1.0.10 has the same bug again.
    Fix is again the same
   as in my previous post. Please add this in the next update, I now keep editing
   your code…
 *  Plugin Author [Weblizar – WordPress Themes & Plugin](https://wordpress.org/support/users/weblizar/)
 * (@weblizar)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-9423014)
 * We will update this by next surely with a new update. Thanks for reminding me
   again and again.
 *  Plugin Support [weblizar_support](https://wordpress.org/support/users/weblizar_support/)
 * (@weblizar_support)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-9426878)
 * Resolve – loop bug in alt and title tag’s value fixed.
 * Please install new version of Seo Image Optimizer plugin (Version – 1.0.11 )

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

The topic ‘Bug: Recursive replacement’ is closed to new replies.

 * ![](https://ps.w.org/seo-image-optimizer/assets/icon-256x256.png?rev=2350359)
 * [Image Optimization For SEO](https://wordpress.org/plugins/seo-image-optimizer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/seo-image-optimizer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/seo-image-optimizer/)
 * [Active Topics](https://wordpress.org/support/plugin/seo-image-optimizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/seo-image-optimizer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/seo-image-optimizer/reviews/)

## Tags

 * [recursive](https://wordpress.org/support/topic-tag/recursive/)

 * 11 replies
 * 5 participants
 * Last reply from: [weblizar_support](https://wordpress.org/support/users/weblizar_support/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/bug-recursive-replacement/#post-9426878)
 * Status: resolved