Detect Visual Composer
Actually _wpb_vc_js_status
since 4.8 is not correct, because it was not used anymore. The simplest way to check if page is using visual composer - it is check for vc_row
shortcode in content.
$post = get_post();if ( $post && preg_match( '/vc_row/', $post->post_content ) ) { // Visual composer works on current page/post}
Yes, you can detect if visual composer is enabled for a post. It's stored in the _wpb_vc_js_status
post meta attribute.
$vc_enabled = get_post_meta($post_id, '_wpb_vc_js_status', true);
Note that a post can still contain the visual composer shortcodes, even when visual composer editing is not currently enabled. For example, if I setup a page with visual composer and then revert back to the normal editor, _wpb_vc_js_status
will be false.