Title: Removing Visual Composer &amp; Shortcodes
Last modified: May 23, 2020

---

# Removing Visual Composer & Shortcodes

 *  Resolved [doyuk](https://wordpress.org/support/users/doyuk/)
 * (@doyuk)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/removing-visual-composer-shortcodes/)
 * Hi,
    I added a function to delete shortcodes like “[vc_row]] [vc_column width
   =” 1/4 “]”. I tested the function outside, it works. But it doesn’t work in XML
   editor.
 * [https://monosnap.com/file/6zHhfndeAfj5rDcmt8LB0twpADhNHT](https://monosnap.com/file/6zHhfndeAfj5rDcmt8LB0twpADhNHT)
   
   [https://monosnap.com/file/CcrSOIO4M7avnu8XPzXvcbTbMKSP0I](https://monosnap.com/file/CcrSOIO4M7avnu8XPzXvcbTbMKSP0I)
   [https://monosnap.com/file/1CALJR49LkOMMnXRkCcOCIsqGxUwck](https://monosnap.com/file/1CALJR49LkOMMnXRkCcOCIsqGxUwck)
 *     ```
       function my_fix_content( $content ) {
       	$content = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $content);
       	$content = preg_replace('~(?:\[/?).*?"]~s', '', $content);
       	$content = preg_replace('(\\[([^[]|)*])', '', $content );
       	$content = preg_replace('/\[(.*?)\]/', '', $content );
       	return $content;
       }
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fremoving-visual-composer-shortcodes%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/removing-visual-composer-shortcodes/#post-12918140)
 * Hi [@doyuk](https://wordpress.org/support/users/doyuk/)
 * > I tested the function outside, it works. But it doesn’t work in XML editor.
 * I’ve opened an internal ticket so that we can look into fixing this in a future
   release. In the meantime, you can use this method instead:
 * 1. Pass the {ID} element to your function instead of the content:
 * `<Content>[my_fix_content({ID})]</Content>`
 * 2. Change your function code to this:
 *     ```
       function my_fix_content( $ID ) {
       	if ( $content = get_post_field( 'post_content', $ID ) ) {
       		$content = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $content);
       		$content = preg_replace('~(?:\[/?).*?"]~s', '', $content);
       		$content = preg_replace('(\\[([^[]|)*])', '', $content );
       		$content = preg_replace('/\[(.*?)\]/', '', $content );
       		return htmlentities( $content );
       	}
       }
       ```
   
 *  Thread Starter [doyuk](https://wordpress.org/support/users/doyuk/)
 * (@doyuk)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/removing-visual-composer-shortcodes/#post-12932617)
 * My issue is resolved now. Thank you!

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

 The topic ‘Removing Visual Composer & Shortcodes’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-export/assets/icon-256x256.png?rev=2570162)
 * [WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel](https://wordpress.org/plugins/wp-all-export/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-export/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-export/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-export/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-export/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-export/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [doyuk](https://wordpress.org/support/users/doyuk/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/removing-visual-composer-shortcodes/#post-12932617)
 * Status: resolved