Title: PHP instead of Javascript?
Last modified: June 27, 2017

---

# PHP instead of Javascript?

 *  Resolved [eic25](https://wordpress.org/support/users/eic25/)
 * (@eic25)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/php-instead-of-javascript/)
 * Just a question:
    Is there a reason why you use Javascript to replace the img
   tag and embed the svg content? Is it an option to use PHP to replace/embed the
   svg content in a future release?

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

 *  Plugin Author [Benbodhi](https://wordpress.org/support/users/benbodhi/)
 * (@benbodhi)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/php-instead-of-javascript/#post-9266118)
 * Hi there,
 * That’s a good question. Swapping out HTML output needs to be done client side
   as far as I can tell. But you’ve triggered my interest. I don’t see this happening
   any time soon, but if it looks like a good option, there’s every possibility 
   I will work with it in the future.
 * What made you think of this may I ask?
 *  Thread Starter [eic25](https://wordpress.org/support/users/eic25/)
 * (@eic25)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/php-instead-of-javascript/#post-9276668)
 * _What made you think of this may I ask?_
 * In my point of view it is more robust to do this server side than client side(
   no different browsers or devices, Javascript disabled, ….).
    The basics are the
   same. Find the corresponding image tags, load the svg file content and replace
   the image tag.
 * A place to start would be the the_content filter.
    But this is not a all detail
   deliberate solution. I am just interested in why this are done like they are 
   done at the moment.
 *  Plugin Author [Benbodhi](https://wordpress.org/support/users/benbodhi/)
 * (@benbodhi)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/php-instead-of-javascript/#post-9277640)
 * Well thank you for letting me know.
    I will actually look into this to see if
   it is possible and maybe write a version that does use PHP (if it will work) 
   then compare performance.
 * I just wrote it this way because it was a solution that worked when I initially
   wrote the plugin and my approach was that I needed to modify the markup so went
   with JS.
 * Very interesting thoughts, thanks for your suggestion.

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

The topic ‘PHP instead of Javascript?’ is closed to new replies.

 * ![](https://ps.w.org/svg-support/assets/icon.svg?rev=3554681)
 * [SVG Support](https://wordpress.org/plugins/svg-support/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/svg-support/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/svg-support/)
 * [Active Topics](https://wordpress.org/support/plugin/svg-support/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/svg-support/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/svg-support/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Benbodhi](https://wordpress.org/support/users/benbodhi/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/php-instead-of-javascript/#post-9277640)
 * Status: resolved