Title: Why span tag rendered as plain text
Last modified: January 8, 2025

---

# Why span tag rendered as plain text

 *  Resolved [sam9023](https://wordpress.org/support/users/sam9023/)
 * (@sam9023)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/)
 * Why span tag render as plain text. Please check the below image and guide me 
   how to fix it. Because of it my user experience is going bad
 * [https://truereviews.uk/wp-content/uploads/2025/01/image-8.png](https://truereviews.uk/wp-content/uploads/2025/01/image-8.png)
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwhy-span-tag-rendered-as-plain-text%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18232127)
 * Hi,
 * The plugin does not change the titles, it requests them from WordPress via the
   [get_the_title()](https://developer.wordpress.org/reference/functions/get_the_title/)
   function and prints it as-is.
 * Do you use an [advanced title field](https://documentation.ajaxsearchlite.com/advanced-options/advanced-title-and-content-fields)
   of some sort? Custom fields usually does not contain HTML tags, but often the
   values are rendered within the theme via custom codes.
 * All the best,
   Ernest
 *  Thread Starter [sam9023](https://wordpress.org/support/users/sam9023/)
 * (@sam9023)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18235768)
 * Hi Ernest,
   I want to style rating using span tag it’s print span tag as plain
   text but before a month it was working properly I style rating using span tagAdvance
   Title: {title} <span class=”rating”>{rating}</span>but now it’s printing this
   <span class=”rating”>{rating}</span> as plain text.Please, guide me how to style
   ratingTHANKS.
 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18236857)
 * Thank you!
 * I think I know what the issue is. In the most recent version there was a change
   regarding attribute escaping in the titles, which is incorrect.
 * I will mark this as a possible bug and change it in the upcoming release.
 * To resolve this, you either have to temporarily downgrade to the previous version
   or make a file change.
 * If you want to make the file change, then open up `wp-content/plugins/ajax-search-
   lite/includes/views/result.php` file on your server, then find this line:
 *     ```wp-block-code
       <?php echo esc_html($r->title); ?>
       ```
   
 * …and replace it with:
 *     ```wp-block-code
       <?php echo $r->title; ?>
       ```
   
 * And that will do the trick.
 * All the best,
   Ernest
    -  This reply was modified 1 year, 3 months ago by [wpdreams](https://wordpress.org/support/users/wpdreams/).
      Reason: Wrong line
 *  [grahambayne](https://wordpress.org/support/users/grahambayne/)
 * (@grahambayne)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18237534)
 * Ernest, thank you very much for posting such a clear answer, I updated from Version
   4.11.2 to Version 4.12.5 and then I had this problem.
 * ![](https://i0.wp.com/data.pugliapools.com/wp-content/uploads/2025/01/after-update.
   png?ssl=1)
 * I read this very post and edited the file as suggested and now I have this again
 * ![](https://i0.wp.com/data.pugliapools.com/wp-content/uploads/2025/01/after-patch.
   png?ssl=1)
 * It is a great plugin, thank you.
 * Graham
 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18238391)
 * Wonderful, then I will make sure to include this in the next release so you don’t
   have to worry about it anymore.
 * If you like the plugin feel free to rate it, it’s greatly appreciated 🙂
 * I will mark this topic as resolved now.
 * All the best,
   Ernest
 *  [k3nsai](https://wordpress.org/support/users/k3nsai/)
 * (@k3nsai)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18250466)
 * Its safer to use
 *     ```wp-block-code
       <?php echo wp_kses_post($r->title); ?>
       ```
   
 * which sanitizes content for allowed HTML tags for post content. More information
   about it on [https://developer.wordpress.org/reference/functions/wp_kses_post/](https://developer.wordpress.org/reference/functions/wp_kses_post/)
 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18252381)
 * [@k3nsai](https://wordpress.org/support/users/k3nsai/) Thank you very much, I
   will test that, looks very promising.
 * Expect a fix within a 2 days as soon as I’m back in office.
 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18267498)
 * Just released 4.12.6, it uses the wp_kses_post method now for added safety. Thanks
   again for the suggestion [@k3nsai](https://wordpress.org/support/users/k3nsai/)

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

The topic ‘Why span tag rendered as plain text’ is closed to new replies.

 * ![](https://ps.w.org/ajax-search-lite/assets/icon-256x256.png?rev=3192672)
 * [Ajax Search Lite - Live Search & Filter](https://wordpress.org/plugins/ajax-search-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-search-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-search-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-search-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-search-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-search-lite/reviews/)

 * 8 replies
 * 4 participants
 * Last reply from: [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/why-span-tag-rendered-as-plain-text/#post-18267498)
 * Status: resolved