0

I'm using WPBakery Page Builder for a new site I'm developing, and I need to add a condition for if WPBakery Page Builder is used for a page or not. I looked through the API documentation, and all I found was a check for if frontend editing is enabled or not:

https://kb.wpbakery.com/docs/inner-api/vc_enabled_frontend/

<?php
if ( vc_enabled_frontend() ) {
    // Front end editor mode is enabled. Do something.
}
?>

This solution is not what I'm looking for. Does anyone know how to check if the plugin is used to build a page or not?

-1

Some quick answer you can achieve what you want to do. There is a filter which check if the current page post type is available for using WPBaker called `vc_is_valid_post_type_be' and there you can manage "can" or "cannot" to load it.

add_filter('vc_is_valid_post_type_be', 'wpse308043_vc_is_valid_post_type_be', 10, 2);
function wpse308043_vc_is_valid_post_type_be($checked_type, $type) {
    global $post;
    if($post->ID == 106)
        return false;

    return $checked_type;
 }
  • WPBakery Page Builder can be available for a page or post type, but not used to create the page. Is it possible to check if the page was built with PB using this filter even if enabled for the post type? – Pegues Jul 9 '18 at 11:31
  • 1
    I think you can check if page was edited by WPBakery plugin by checking post meta _wpb_vc_js_status' which say true` if so and the method description says Saves VC Backend editor meta box visibility status. or each post edited by WPB should have _vc_post_settings meta with settings of current page. So, back to your question - you can check page settings in every admin hook but if you like to load or unload WPBakery plugin vc_is_valid_post_type_be is pretty good idea – Kamil Jul 9 '18 at 11:48
  • Thank you for pointing me in the direction you posted in your comment. I was then able to find the following post that works for me: stackoverflow.com/questions/29312067/… – Pegues Jul 9 '18 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.