Skip to content

Instantly share code, notes, and snippets.

@SanjeevMohindra
Last active October 4, 2017 11:37
Show Gist options
  • Save SanjeevMohindra/b63cb46cb83aa47bd115caa011d67e42 to your computer and use it in GitHub Desktop.
Save SanjeevMohindra/b63cb46cb83aa47bd115caa011d67e42 to your computer and use it in GitHub Desktop.
Replace existing shortcakes with a new shortcode
<?php
/**
* Remove ShortCode Plugin
*
* This function will remove the shortcode from getting diplayed while keep displaying the content.
* Add this to your function.php
*
* @author MetaBlogue
* @license GPL-2.0+
* @link https://metablogue.com/wordpress-remove-shortcode-plugin/
*/
// Sample Shortcode to replace it with a new shortcode
function mb_test_shortcode_content( $atts, $content = NULL ) {
extract(shortcode_atts(array(
'arg1' => '',
'arg2' => ''
),$atts));
////If the attributes are not same, you may need to format the attributes in below function call
return do_shortcode('[test2 arg1="' .$arg1 .'"]');
}
add_shortcode('test1', 'mb_test_shortcode_content');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment