Clearing the text from the shortcode

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.

1 Like