Skip to content

Instantly share code, notes, and snippets.

@wolfthemes
Created October 6, 2017 11:37
Show Gist options
  • Select an option

  • Save wolfthemes/bc653983394bb4f45986804e1c530e53 to your computer and use it in GitHub Desktop.

Select an option

Save wolfthemes/bc653983394bb4f45986804e1c530e53 to your computer and use it in GitHub Desktop.
/*
* Re-add disabled element
* http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key
*
* List of diabled elements:
* 'vc_section',
* 'vc_tour', // deprecated
* 'vc_btn', // deprecated
* 'vc_tta_accordion',
* 'vc_tta_tabs',
* 'vc_tta_pageable',
* 'vc_round_chart',
* 'vc_line_chart',
* 'vc_text_separator',
* 'vc_facebook',
* 'vc_tweetmeme',
* 'vc_googleplus',
* 'vc_pinterest',
* 'vc_images_carousel',
* 'vc_tour',
* 'vc_teaser_grid',
* 'vc_posts_grid',
* 'vc_carousel',
* 'vc_posts_slider',
* 'vc_button2',
* 'vc_btn',
* 'vc_cta_button',
* 'vc_cta_button2',
* 'vc_basic_grid',
* 'vc_media_grid',
* 'vc_masonry_grid',
* 'vc_masonry_media_grid',
*/
function readd_el( $disabled_elements ) {
// replace vc_basic_grid by your element slug
if ( ( $key = array_search( 'vc_basic_grid', $disabled_elements ) ) !== false) {
unset( $disabled_elements[ $key ] );
}
// replace vc_media_grid by your element slug
if ( ( $key = array_search( 'vc_media_grid', $disabled_elements ) ) !== false) {
unset( $disabled_elements[ $key ] );
}
return $disabled_elements;
}
add_filter( 'wvc_disabled_elements', 'readd_el' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment