Is there a way to detect if a WordPress page is using Visual Composer?
I have 2 different page templates:
- Default template for regular pages.
- Template for visual composer pages.
I’m hoping there is a way to detect if a user is using visual composer to build the page instead of relying on the user selecting the visual composer template each time.
Is there a way to detect what page is being built and then assign a template based on that?
only for WPBakery Page Builder
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 wpbakery – it is check forvc_row
shortcode in content.Yes, you can detect if visual composer is enabled for a post. It’s stored in the
_wpb_vc_js_status
post meta attribute.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.You can detect with is_plugin_active:
works like a charm. I was searching for a possibility to hide the Nag screen that occurs when you get the WPBakery Page Builder as a bundeled plugin with a commercial theme to avoid customer’s confusion. In case someone could need that snippet:
Hook that into admin_init and you’re good to go!