# Clearing the text from the shortcode

**URL:** https://meta.discourse.org/t/clearing-the-text-from-the-shortcode/58036
**Category:** WordPress
**Created:** [2017 年 2 月 27 日午後 8:32 UTC](https://meta.discourse.org/t/clearing-the-text-from-the-shortcode/58036 "2017-02-27T20:32:32Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Del33t](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@Del33t](https://meta.discourse.org/u/Del33t)
#### Post date: [2017 年 3 月 1 日午後 8:38 UTC](https://meta.discourse.org/t/clearing-the-text-from-the-shortcode/58036/5 "2017-03-01T20:38:49Z")

</div>

I am an absolutely terrible coder but I found a simple solution for my situation. In the discourse\_publish.php file I added the following code where other trimming to $baked was taking place:

```
	$baked = str_replace( '[nk_title]', '<h2>', $baked );
	$baked = str_replace( '[/nk_title]', '</h2>', $baked );
	$baked = str_replace( '[yp_text]', '<p>', $baked );
	$baked = str_replace( '[/yp_text]', '</p>', $baked );		

	$baked = preg_replace('(\\[([^[]|)*])', '', $baked );

```

The top 4 lines reformat some of the special shortcodes used in my theme and the bottom line removes all other […] strings.

---

_[View the full topic](https://meta.discourse.org/t/clearing-the-text-from-the-shortcode/58036)._
