Skip to content

Snippet: Add a Shortcode to the Editor Options

add_filter( 'wpex_shortcodes_tinymce_json', function( $data ) {

	// Add your custom shortcode
	$data['shortcodes']['my_custom_shortcode'] = array(
		'text' => __( 'Custom Shortcode', 'total' ),
		'insert' => '[custom_shortcode parameter1="value"]',
	);

	// Return data
	return $data;

} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top